velimir

poraka

Apr 5th, 2012
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     string si, ti;
  9.     int x, z, m, n, i, j, q;
  10.     cin >> x;
  11.     int niza[100]={0}, y[100]={0};
  12.     for(i=0; x>i; i++){
  13.         cin >> si >> ti;
  14.         y[i] = si.length();
  15.         z = ti.length();
  16.         n = 0;
  17.         m = 0;
  18.         q = 0;
  19.         for(j=0; j<y[i]; j++){
  20.             for(q=n; q<z; q++){
  21.                 if(si[j]==ti[q]){
  22.                     m++;
  23.                     n = q+1;
  24.                     niza[i] = m;
  25.                     break;
  26.                 }
  27.             }
  28.         }
  29.     }
  30.     for(int a=0; x>a; a++){
  31.         if(niza[a]==y[a])cout << "DA" << endl;
  32.         else cout << "NE" << endl;
  33.     }
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment