Advertisement
Joao_Joao

Getline Three - C++

May 14th, 2022
865
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define r(x, ns) for(auto& x : ns)
  5.  
  6. int main() {
  7.   int ct = 0;
  8.   string n, p;
  9.   while(cin>>n) {
  10.     if(ct) cout<<'\n';
  11.     int x, m = 0, f = 0;
  12.     getline(cin, p), getline(cin, p);
  13.     string sum = "";
  14.     r(l, p) {
  15.       if(l == 'M' || l == 'F') {
  16.         if (sum == n) (l == 'M' ? ++m : ++f);
  17.         sum = "";
  18.       }
  19.       else if(l != ' ') sum += l;
  20.     }
  21.     printf("Caso %d:\nPares Iguais: %d\nF: %d\nM: %d\n", ++ct, m + f, f, m);
  22.   }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement