while True:
    try:
        s = input()
        count = 0
        for i in s:
            if 'A'<= i <= 'Z':
                count += 1
        print(count)
    except:
        break