求解、、、、、
import java.util.*;public class Main {
public static void main(String[] args) {
Scanner sca = new Scanner(System.in);
String sh;
int id = 1, co,n;
while (sca.hasNext()) {
sh = sca.nextLine();
n = sca.nextInt();//当第二次运行时这行会出错,想问下怎么解决???
System.out.printf("Case %d:", id++);
for (int i = 0; i < n; i++) {
String s = sca.next();
char c = s.charAt(0);
co = 0;
for (int j = 0; j < sh.length(); j++) {
if (sh.charAt(j) == c) {
co++;
}
}
System.out.print(c + "--" + co + " ");
}
System.out.println();
}
}
}