while True:
    try:
        n = input().split()
        list = []
        for i in n:
            for m in i:
                if m.isupper():
                    list.append(m)
        print(len(list))
    except:
        break