public class Demo {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("输出");
HashMap<Character,Integer> hm = new HashMap<>();
String line =sc.nextLine();
char[]arr =line.toCharArray();
for (char c : arr) {
hm.put(c, !hm.containsKey(c)?1:hm.get(c)+1);
}
for (Character c : hm.keySet()) {
System.out.println(c+".."+hm.get(c));
}
}
} |
|