Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getCount(over, ball):
- if over != 0 and ball != 0:
- if over > 1 and ball > 1:
- return str(over) + ' OVERS ' + str(ball) + ' BALLS'
- if over > 1 and not ball > 1:
- return str(over) + ' OVERS ' + str(ball) + ' BALL'
- if ball > 1 and not over > 1:
- return str(over) + ' OVER ' + str(ball) + ' BALLS'
- return str(over) + ' OVER ' + str(ball) + ' BALL'
- if over == 0:
- if ball > 1:
- return str(ball) + ' BALLS'
- return str(ball) + ' BALL'
- if ball == 0:
- if over > 1:
- return str(over) + ' OVERS'
- return str(over) + ' OVER'
- T = int(input())
- for t in range(T):
- S = input()
- over = 0
- ball = 0
- for c in S:
- if c == 'D' or c == 'N'or c == 'W':
- continue
- elif c == 'O' or int(c) in range(0,7):
- ball = ball + 1
- over = over + int(ball / 6)
- ball = ball % 6
- print(getCount(over, ball))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement