import java.util.*;
class S
{
String str,str1;
int i,j,len,c;
char ch[],ch1;
Scanner sc=new Scanner(System.in);
public void show()
{
str1="";
c=0;
System.out.print("\nEnter the sentence:");
str=sc.nextLine().toLowerCase();
len=str.length();
ch=new char[len];
System.out.print("\nEntered sentence:"+str);
for(i=0;i<len;i++)
{
ch1=str.charAt(i);
for(j=0;j<c;j++)
{
if( str1.charAt(j)==ch1)
break;
}
if(j==c)
{
str1=str1+ch1;
ch[c++]=ch1;
}
}
System.out.print("\nSentence elimination of repeated letters:"+str1);
}
}
class S
{
String str,str1;
int i,j,len,c;
char ch[],ch1;
Scanner sc=new Scanner(System.in);
public void show()
{
str1="";
c=0;
System.out.print("\nEnter the sentence:");
str=sc.nextLine().toLowerCase();
len=str.length();
ch=new char[len];
System.out.print("\nEntered sentence:"+str);
for(i=0;i<len;i++)
{
ch1=str.charAt(i);
for(j=0;j<c;j++)
{
if( str1.charAt(j)==ch1)
break;
}
if(j==c)
{
str1=str1+ch1;
ch[c++]=ch1;
}
}
System.out.print("\nSentence elimination of repeated letters:"+str1);
}
}
No comments:
Post a Comment