Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <iomanip>
  4. #include <string>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int x,n, y = 0 , u=0;
  10.     string p, s , r[200];
  11.     bool e;
  12.     cin >> x;
  13.  
  14.  
  15.     for (int i = 1; i <= x; i++){
  16.         cin >> n;
  17.         cin >> p;
  18.  
  19.         for (int j = 0; j <= n; j++){
  20.             getline(cin, s);
  21.             for (unsigned int i = 0; i < p.length(); i++){
  22.  
  23.                 if (p[i] == s[i]){
  24.                     e = true;
  25.  
  26.                 }
  27.                 else{
  28.                     e = false; break;
  29.                 }
  30.  
  31.             }
  32.             if (e == true){
  33.                 y++;
  34.  
  35.                 r[u] = s;
  36.                 u++;
  37.             }
  38.  
  39.         }
  40.         if (y > 0){
  41.             cout << y << endl;
  42.             for (int i = u; i >= 0; i--){
  43.                 cout << r[i] << endl;
  44.             }
  45.             y = 0;
  46.             u = 0;
  47.         }
  48.         else cout << "Conan's assumption is wrong!" << endl;
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement