Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <iomanip>
- #include <string>
- #include <algorithm>
- #include <set>
- #include <list>
- #include <sstream>
- #include <vector>
- #include <map>
- #include <stdlib.h>
- using namespace std;
- ifstream in("input.txt");
- ofstream out("output.txt");
- int main() {
- int n;
- cin >> n;
- string h;
- string* p = new string[n];
- string* pc = new string[n];
- for (int i = 0; i < n; i++) {
- cin >> h;
- p[i] = h;
- cin >> h;
- pc[i] = h;
- }
- for (int i = 0; i < n; i++) {
- string a = p[i];
- string b = pc[i];
- bool f = false;
- int minim = 1000000000000;
- int maxim = -100000000000;
- int j = a.length() - b.length();
- while (b.find(a[0]) && !a.empty()) {
- int x = b.find(a[0]);
- minim = min(minim, x);
- maxim = max(maxim, x);
- b.erase(b.find(a[0]));
- a.erase(0);
- f = true;
- }
- if (f) {
- cout << "YES" << endl;
- }
- else {
- cout << "NO" << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement