#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   int main() {     ios::sync_with_stdio(false);     int t;     cin >> t;     while (t--) {       string s, t;       cin >> s >> t;       vector<int> each[26];       int n, m;       n = s.length();       m = t.length();       for (int i = 0; i < n; ++i) {         each[s[i] -  a ].push_back(i);       }       int las = INF, res = 0;       for (int i = 0; i < m; ++i) {         if (upper_bound(each[t[i] -  a ].begin(), each[t[i] -  a ].end(), las) !=             each[t[i] -  a ].end()) {           las =               *upper_bound(each[t[i] -  a ].begin(), each[t[i] -  a ].end(), las);         } else {           if (each[t[i] -  a ].empty()) {             res = -1;             break;           } else {             res++;             las = each[t[i] -  a ][0];           }         }       }       cout << res << endl;     }     return 0;   }   