fork download
#include <iostream>

using namespace std;

string str1, str2;
int testy;

int main()
{
    cin>>testy;
    while(testy--)
    {
        cin.ignore();
        cin>>str1>>str2;
        int f, s;
        f=str1.length();
        s=str2.length();
        if(s>f)
        {
            cout<<"NIE"<<endl;
            continue;
        }
        int it=0;
        for(int i=0; i<f; ++i)
        {
            if(str1[i]==str2[it])
                it++;
            if(it==s)
            {
                break;
            }
        }
        if(it==s)
        {
             cout<<"TAK"<<endl;

        }
        else
        {
            cout<<"NIE"<<endl;
        }
    }
    return 0;
}
Success #stdin #stdout 0.01s 5280KB
stdin
4
ALGOLIGA GOLA
LATWEZADANIE LATANIE
SSAK KAS
ALAMA ALAMAKOTA
stdout
TAK
TAK
NIE
NIE