题解 | #计算某字符出现次数#
计算某字符出现次数
http://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1
输入字符后,在单输入一个字符,replaceAll将会排除所有不符合的字符,strip获得所有已经排除的字符,由a的字符长度减去strip的字符长度
``` public static void main(String[] args) {
Scanner s=new Scanner(System.in);
String a=s.nextLine();
String b=s.nextLine();
String strip=a.toUpperCase().replaceAll(b.toUpperCase()," ");
System.out.println(a.length()-strip.length());
}