PROGRAM
import java.util.Scanner;
public class DuplicateLetters{
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
String letter = scan.next(); // Input from User
String srr[] = letter.split("");
for(int i = 0; i<srr.length;i++){
int count = 1;
if(!srr[i].equals("$")){
for(int j = i+1; j<srr.length;j++){
if(srr[i].equals(srr[j])) {
srr[j] = "$";
count++;
}
}
System.out.println(srr[i] +" "+count);
}
}
}
}
Input
BeginnersBook.com
Output
B 2
e 2
g 1
i 1
n 2
r 1
s 1
o 3
k 1
. 1
This comment has been removed by a blog administrator.
ReplyDeleteHey, your article is interesting. I will share with my friends. My colleagues were taking about cloudcouncil that they provide certification in Java. As you have knowledge in it can you help me is that worth studying and get certified ? https://cloudcouncil.org/
ReplyDeletecanlı sex hattı
ReplyDeletehttps://girisadresi.info/
salt likit
salt likit
RHH
ataÅŸehir
ReplyDeleteadana
ankara
uÅŸak
muÅŸ
Z2US