This commit is contained in:
2023-11-15 22:10:55 +01:00
parent 38610bdd11
commit ae55249b47

23
nop.py Normal file
View File

@@ -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()