Ankit_132

B

Jul 7th, 2023
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1.  
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. #define ll     long long
  7. #define _test   int _TEST; cin>>_TEST; while(_TEST--)
  8.  
  9. int main()
  10. {
  11.     _test
  12.     {
  13.         string s[3];
  14.         cin>>s[0]>>s[1]>>s[2];
  15.  
  16.         char f = '/';
  17.  
  18.         for(int i=0; i<3; i++)
  19.         {
  20.             if(s[i][0]==s[i][1] && s[i][1]==s[i][2] && s[i][1]!='.')
  21.                 f = s[i][0];
  22.         }
  23.  
  24.         for(int i=0; i<3; i++)
  25.         {
  26.             if(s[0][i]==s[1][i] && s[1][i]==s[2][i] && s[1][i]!='.')
  27.                 f = s[0][i];
  28.         }
  29.  
  30.         if(s[0][0]==s[1][1] && s[1][1]==s[2][2] && s[1][1]!='.')
  31.             f = s[0][0];
  32.         if(s[0][2]==s[1][1] && s[1][1]==s[2][0] && s[1][1]!='.')
  33.             f = s[0][2];
  34.  
  35.         if(f == '/')        cout<<"DRAW\n";
  36.         else                cout<<f<<"\n";
  37.     }
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment