diff --git a/nop.py b/nop.py new file mode 100644 index 0000000..fa284d1 --- /dev/null +++ b/nop.py @@ -0,0 +1,23 @@ +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()