Advertisement
Luxeon94

17/18 Q2: Donald trump count; X15340

Nov 15th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.     int n;
  6.     while(cin >> n){
  7.         string s;
  8.         int count=0;
  9.         bool possible=false;
  10.         for(int i=0; i<n; ++i){
  11.             cin >> s;
  12.             if(possible){
  13.                 if(s=="trump") ++count;
  14.                 possible=false;
  15.             }
  16.             if(s=="donald") possible=true;
  17.         }
  18.         cout << count <<endl;
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement