| 1 | #include<iostream> |
| 2 | using namespace std; |
| 3 | int main() |
| 4 | { |
| 5 | int t; |
| 6 | cin>>t; //Input of number of testcases |
| 7 | while(t--) |
| 8 | { |
| 9 | string s; |
| 10 | cin>>s; //Input of a String containing x or y letters |
| 11 | int i,c=0; |
| 12 | //Calculating the maximum numbers of pairs formed |
| 13 | for(i=0;i<s.length();i++) |
| 14 | { |
| 15 | if((s[i]=='x'&&s[i+1]=='y')||(s[i]=='y'&&s[i+1]=='x')) |
| 16 | { |
| 17 | c++; //If y letter is the next element of x or x letter is the next element of y then we increase the c by 1 |
| 18 | i++; |
| 19 | } |
| 20 | } |
| 21 | cout<<c<<endl; //printing the maximum number of pairs |
| 22 | |
| 23 | } |
| 24 | return 0; |
| 25 | |
| 26 | } |
nothing calls this directly
no outgoing calls
no test coverage detected