while True:
    try:
        import re
        s=input()
        pattern=r'[A-Z]'
        NEW=re.findall(pattern, s)
        new=''.join(NEW)
        print(len(new))
    except:
        break