fork(6) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. string str1, str2;
  6. int testy;
  7.  
  8. int main()
  9. {
  10. cin>>testy;
  11. while(testy--)
  12. {
  13. cin.ignore();
  14. cin>>str1>>str2;
  15. int f, s;
  16. f=str1.length();
  17. s=str2.length();
  18. if(s>f)
  19. {
  20. cout<<"NIE"<<endl;
  21. continue;
  22. }
  23. int it=0;
  24. for(int i=0; i<f; ++i)
  25. {
  26. if(str1[i]==str2[it])
  27. it++;
  28. if(it==s)
  29. {
  30. break;
  31. }
  32. }
  33. if(it==s)
  34. {
  35. cout<<"TAK"<<endl;
  36.  
  37. }
  38. else
  39. {
  40. cout<<"NIE"<<endl;
  41. }
  42. }
  43. return 0;
  44. }
  45.  
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Standard output is empty