From ae55249b47daf8304fc7005b355d36817523d372 Mon Sep 17 00:00:00 2001 From: Jethro Stapelbroek Date: Wed, 15 Nov 2023 22:10:55 +0100 Subject: [PATCH] NOP --- nop.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 nop.py 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()