import re
def func(string):
    f = re.sub('[^A-Z]','',string)
    print(len(f))
while 1:
    try:
        func(input())
    except:
        break