/* 先把字符串轉為字符數組,遍歷字符數組,若ASCII碼在65-90之間,則count+1 */ import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); while(sc.hasNext()){ String str = sc.nextLine(); int count = 0; char ss[] = str.toCharArray(); for (int i = 0; i < ss.length; i++){ if(ss[i]>='A' && ss[i]<='Z'){ count++; } } System.out.println(count); } } }