import java.util.LinkedHashMap; import java.util.Map; import java.util.Scanner; public class Main1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); String[] strs = str.split("\\W+"); Map<String, Integer> map = new LinkedHashMap<String, Integer>(); for (String s : strs) { String c=s.toUpperCase(); if (map.containsKey(c)) { map.put(c, (map.get(c) + 1)); } else { map.put(c, 1); } } int max = 0; for (String c : map.keySet()) { if (c.length() > max) { max = c.length(); } } for (String c : map.keySet()) { for (int i = 0; i < max - c.length(); i++) { System.out.print(" "); } System.out.print(c.toUpperCase() + ":"); for (int i = 0; i < map.get(c); i++) { System.out.print("*"); } System.out.println(map.get(c)); } } }
0.0分
1 人评分