题解 | #统计大写字母个数#
统计大写字母个数
http://www.nowcoder.com/practice/434414efe5ea48e5b06ebf2b35434a9c
机考考这个多爽
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
while(scan.hasNext()){
String str = scan.nextLine();
int count = 0;
for(char c : str.toCharArray()){
if(String.valueOf(c).matches("[A-Z]")){
count++;
}
}
System.out.println(count);
}
scan.close();
}
}