Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #include<string.h>
- using namespace std;
- int main(){
- int t;
- cin >> t;
- while(t--){
- string str;
- cin >> str;
- int overs=0;
- int balls=0;
- overs= str.size()/6;
- balls= str.size()%6;
- int run=0;
- int wicket=0;
- for(int i=0; i<str.size(); i++){
- if(str[i]=='W'){
- wicket++;
- }else{
- int x;
- x = int(str[i])-48;
- run=run+x;
- }
- }
- string o= " Over ";
- string r= " Run ";
- string w= " Wicket";
- if((overs+balls*0.1)> 1.0){
- o = " Overs ";
- }
- if((run)> 1){
- r = " Runs ";
- }
- if(wicket> 1){
- w = " Wickets";
- }
- cout << overs << "." << balls << o << run << r << wicket << w << ".\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement