class Frequency
{
public static void main(String args[])throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s;
char ch ;
System.out.println("Enter a String ");
s=br.readLine();
for(int i=0;i
int c=0;
ch=s.charAt(i);
for(int j=0;j
if(s.charAt(j)==ch)
c++;
}
System.out.println(ch + " has " + c + " frequency ");
}
}
}
1 comment:
if i enter a word hello,
the program will print l 2 times. The program should print should have a list of letters present in the word(without repetitions) and the corresponding frequency
Post a Comment