NOP
This commit is contained in:
23
nop.py
Normal file
23
nop.py
Normal 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()
|
||||||
Reference in New Issue
Block a user