import java.util.Scanner; import java.util.TreeMap; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String str = scanner.next(); //将字符存入TreeMap TreeMap<Character,Integer> map = new TreeMap<>(); ...