while True:
try:
str_input = input()
count = 0
for c in str_input:
if ord(c) >= 65 and ord(c) <= 90:
count += 1
print(count)
except:
break
while True:
try:
str_input = input()
count = 0
for c in str_input:
if ord(c) >= 65 and ord(c) <= 90:
count += 1
print(count)
except:
break