Advertisement
Josif_tepe

Untitled

Feb 4th, 2021
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <vector>
  4. using namespace std;
  5. int main()
  6. {
  7.     int n;
  8.     cin >> n;
  9.     while(n--) { // izmini n broevi
  10.         string a, b;
  11.         cin >> a >> b;
  12.         int i = 0, j = 0;
  13.         while(i < a.size() && j < b.size()) {
  14.             if(a[i] == b[j]) {
  15.                 i++;
  16.                 j++;
  17.             }
  18.             else {
  19.                 j++;
  20.             }
  21.         }
  22.         if(i == a.size()) {
  23.             cout << "DA" << endl;
  24.         }
  25.         else {
  26.             cout << "NE" << endl;
  27.         }
  28.     }
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement