Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define _test int _TEST; cin>>_TEST; while(_TEST--)
- int main()
- {
- _test
- {
- string s[3];
- cin>>s[0]>>s[1]>>s[2];
- char f = '/';
- for(int i=0; i<3; i++)
- {
- if(s[i][0]==s[i][1] && s[i][1]==s[i][2] && s[i][1]!='.')
- f = s[i][0];
- }
- for(int i=0; i<3; i++)
- {
- if(s[0][i]==s[1][i] && s[1][i]==s[2][i] && s[1][i]!='.')
- f = s[0][i];
- }
- if(s[0][0]==s[1][1] && s[1][1]==s[2][2] && s[1][1]!='.')
- f = s[0][0];
- if(s[0][2]==s[1][1] && s[1][1]==s[2][0] && s[1][1]!='.')
- f = s[0][2];
- if(f == '/') cout<<"DRAW\n";
- else cout<<f<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment