SUPOVR - Super Over

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

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

hide comments
2015-06-06 08:30:27 Shubham Jain
easy prob :) just a little care about current batsmen is required
2015-03-13 08:16:12 Krishna Mohan
It is difficult for those who do not follow cricket. The concept of rotating strike is not mentioned in the question, Otherwise easy.
2014-07-07 08:41:47 surayans tiwari(http://bit.ly/1EPzcpv)
please explain the second test case why there are only 4 balls not 6??
2014-01-02 09:52:49 ac

could u please check id:10774009

Last edit: 2013-12-31 16:08:28
2014-01-02 09:52:49 atp69
spaces in the input.. O is for out..costed me few wa
2014-01-02 09:52:49 Bhavik
too easy for cricket followers...:)
2014-01-02 09:52:49 Andrey Maksimenko
2) If two wickets fall before 6 valid balls then team is considered all-out.

What does it mean?
2014-01-02 09:52:49 Andrey Maksimenko
It's not a programming problem! It's UNDERSTANDING problem description problem!!! Please, move it to tutorial.
2014-01-02 09:52:49 jiglipufff
Easy One :)
2014-01-02 09:52:49 Sachin Railhan
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.

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.