package month6.daily.day613;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Set;
/**
- Created by Administrator on 2019/6/13.
*/
public class c {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
System.out.print(“输入字符串:”);
String str=in.next();
char c[]=str.toCharArray();
HashMap<Character,Integer> hm=new HashMap();
for(char c1:c){
if(!hm.containsKey(c1)){
hm.put(c1,1);
}else{
Integer i=hm.get(c1);
hm.put(c1,i+1);
}
}
System.out.println(hm);
int max=0;
char maxC=‘a’;
Set set=hm.keySet();
for(char c1:set){
if(hm.get(c1)>max){
max=hm.get(c1);
maxC=c1;
}
}
System.out.println(“出现最多次数的字符:”+maxC+“次数:”+max);
}
}