fork(2) download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int test;
  5. string haslo1,haslo2;
  6.  
  7. int spraw(string h1, string h2)
  8. {
  9. int dl;
  10. dl=h1.length();
  11.  
  12. for(int i=0;i<=dl;i++)
  13. {
  14. if(h1.length()!= h2.length()) return false;
  15. else if(h1==h2) return true;
  16. else if(h2[i]=='*') return true;
  17. else if(h1[i]!=h2[i]) return false;
  18. }
  19. }
  20.  
  21. int main()
  22. {
  23. cin>>test;
  24. for(int i=1;i<=test;i++)
  25. {
  26.  
  27.  
  28. cin>>haslo1>>haslo2;
  29.  
  30.  
  31. if(spraw(haslo1,haslo2)==false) cout<<"error"<<endl;
  32. else if(spraw(haslo1,haslo2)==true)cout<<"ok"<<endl;
  33.  
  34. }
  35.  
  36. return 0;
  37. }
Success #stdin #stdout 0s 15240KB
stdin
2
fraktal
**ak**l
FRAKTAL
F*RAKTAL
stdout
ok
error