UPPERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" instructions = input().strip() i = 0 nop_count = 0 while True: try: if instructions[i + 1] in UPPERS: nop_count += 3 i += 1 elif instructions[i + 2] in UPPERS: nop_count += 2 i += 2 elif instructions[i + 3] in UPPERS: nop_count += 1 i += 3 else: i += 4 except IndexError: print(nop_count) exit()