SUPOVR - Super Over

no tags 

An IPL match is going on between two teams and its a tie !!! So they decided to have a Super Over.

Rules of Super Over are as follows:

1) There has to be 6 valid balls.

2) If two wickets fall before 6 valid balls then team is considered all-out.

3) Wide and No-ball are not valid balls.

So, there are three batsmen b1, b2, b3. Initially b1 is playing (on strike) and b2 is at the other end (non-strike). If any one of them gets out, b3 replaces that batsmen.

At the end of the over, determine the number of runs scored by b1, b2 and b3 respectively.

Input

Input contains 1 line. Runs scored in every ball.

W stands for wide, N stands for No-ball and O stands for out.

Output

Output contains three lines. Each line contains runs scored by b1, b2 and b3 repectively.

Example

Input 1:
1 1 1 1 1 1

Output 1:
3
3
0

Input 2:
3 0 O O Output 2: 3
0
0

hide comments
Shubham Jain: 2015-06-06 08:30:27

easy prob :) just a little care about current batsmen is required

Krishna Mohan: 2015-03-13 08:16:12

It is difficult for those who do not follow cricket. The concept of rotating strike is not mentioned in the question, Otherwise easy.

surayans tiwari(http://bit.ly/1EPzcpv): 2014-07-07 08:41:47

please explain the second test case why there are only 4 balls not 6??

ac: 2014-01-02 09:52:49


could u please check id:10774009

Last edit: 2013-12-31 16:08:28
atp69: 2014-01-02 09:52:49

spaces in the input.. O is for out..costed me few wa

Bhavik: 2014-01-02 09:52:49

too easy for cricket followers...:)

Andrey Maksimenko: 2014-01-02 09:52:49

2) If two wickets fall before 6 valid balls then team is considered all-out.

What does it mean?

Andrey Maksimenko: 2014-01-02 09:52:49

It's not a programming problem! It's UNDERSTANDING problem description problem!!! Please, move it to tutorial.

jiglipufff: 2014-01-02 09:52:49

Easy One :)

Sachin Railhan: 2014-01-02 09:52:49

No Need to know all the rules.Just consider these rules.
There are two ends - (SE)Striking end and (RE)running end.
Initially b1 is at SE and b2 is at RE.
Ball is bowled to player at SE.
If player hits odd runs(1,3,5) then he will move to RE and player to RE will come at SE.
There is no rotation if he scores even runs(2,4,6).
And if player at SE miss the ball or in problem terms he gets out, he will be replaced by new player.New player will come at SE.No change will occur at RE.
Hope this helps.
And yes problems like this should be avoided.


Added by:Savan Popat
Date:2013-09-19
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All