KISA Programs
KISA Programs
import java.util.*;
public class removingdoubleletter
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
String str,str1="";
System.out.println("enter a string");
str=sc.nextLine();
char ch=' ';
int len=str.length();
for(int i=0;i<len;i++)
{
char ch1=str.charAt(i);
if(ch!=ch1)
{
str1=str1+ch1;
ch=ch1;
}
System.out.println("new string is"+str1);
}
}
Output:
enter a string
Comppputtterrr Applicationsss
new string isComputer Aplications
2. Write a program in Java to accept a String and convert it into lowercase and encode the string
with +2 character. Print the accepted and encoded string.
import java.util.*;
public class encode
{
public static void main(String args[])
{
Output:
enter a string
computerrAAXYZ
the accepted computerraaxyz
the encoded eqorwvgttcczab