Advertisement
bappi2097

Daffodil Team Contest 2019-08-07-G

Aug 7th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.32 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     ios_base::sync_with_stdio(false);
  6.     cin.tie(NULL);
  7.     #ifndef ONLINE_JUDGE
  8.     freopen("input.txt","r",stdin);
  9.     freopen("output.txt","w",stdout);
  10.     #endif // ONLINE_JUDGE
  11.     int n;
  12.     cin>>n;
  13.     while(n--)
  14.     {
  15.         string str1,str2;
  16.         cin>>str1>>str2;
  17.         int bl=0;
  18.  
  19.         for(int i=0;i<str1.size()-3 && !bl;i++)
  20.         {
  21.             if(str1[i]==str2[0] && str1[i+1]==str2[1] && str1[i+2]==str2[2] && str1[i+3]==str2[3])bl=1;
  22.         }
  23.         for(int i=0;i<str1.size()-2 && !bl;i++)
  24.         {
  25.             if(str1[i]==str2[1] && str1[i+1]==str2[2] && str1[i+2]==str2[3])bl=2;
  26.         }
  27.         for(int i=0;i<str1.size()-2 && !bl;i++)
  28.         {
  29.             if(str1[i]==str2[0] && str1[i+1]==str2[1] && str1[i+2]==str2[2])bl=2;
  30.         }
  31.         for(int i=0;i<str1.size()-2 && !bl;i++)
  32.         {
  33.             if(str1[i]==str2[0] && str1[i+1]==str2[2] && str1[i+2]==str2[3])bl=2;
  34.         }
  35.         for(int i=0;i<str1.size()-2 && !bl;i++)
  36.         {
  37.             if(str1[i]==str2[0] && str1[i+1]==str2[1] && str1[i+2]==str2[3])bl=2;
  38.         }
  39.         if(bl==1)cout<<"good"<<endl;
  40.         else if(bl==2)cout<<"almost good"<<endl;
  41.         else cout<<"none"<<endl;
  42.         str1.clear();
  43.         str2.clear();
  44.     }
  45.     return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement