62,628
社区成员
发帖
与我相关
我的任务
分享
import java.util.Scanner;
public class Test{
public static void main(String[] args){
System.out.print("Input the content:");
Scanner keyboard = new Scanner(System.in);
String content = keyboard.nextLine();
String first = null;
int count = 0;
while(content.length() != 0){
first = content.charAt(0) + "";
count = content.length() - (content = content.replaceAll("[" + first + "]","")).length();
System.out.printf("'%s' 出现 %d 次.\n",first,count);
}
}
}