This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
def switch(current):
if current == 'H':
return 'O'
elif current == 'O':
return 'N'
elif current == 'N':
return 'I'
elif current == 'I':
return 'H'
def solve(start, s, current):
if start >= len(s):
return 0
if s[start] == current and current == 'O':
return 1 + solve(start + 1, s, switch(current))
elif s[start] == current:
return solve(start + 1, s, switch(current))
else:
return solve(start + 1, s, current)
s = input()
print(solve(0, s, 'H'))
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |