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
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
|
|
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.
|
|
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.
|
Added by: | Savan Popat |
Date: | 2013-09-19 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |