public class FirstRepeatedString {
public static void main(String[] args) {
System.out.println("Enter the String !");
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
getRepeated(str);
}
public static void getRepeated(String name) {
Map<character,> map = new HashMap<character,>();
for(int i = 0; i < name.length(); i++) {
char c = name.charAt(i);
Integer count = map.get(c);
if (count == null) {
count = 0;
}
map.put(c, count + 1);
}
Set<character> a = map.keySet();
for (Character t : a) {
System.out.println(t + " Ocurred " + map.get(t) + " times");
}
}
}</character>