fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;
  6. cin >> t;
  7. while(t--)
  8. {
  9. int flag=0;
  10. char arr[8][8];
  11. for(int i=0;i<8;i++)
  12. {
  13. for(int j=0;j<8;j++)
  14. {
  15. cin >> arr[i][j];
  16. }
  17. }
  18. for(int i=0;i<8;i++)
  19. {
  20. int c=0;
  21. for(int j=0;j<8;j++)
  22. {
  23. if(arr[i][j]=='R')
  24. {
  25. c++;
  26. }
  27. if(c==8)
  28. {
  29. flag = 1;
  30. break;
  31. }
  32. }
  33.  
  34. }
  35. if(flag == 1)
  36. {
  37. cout << "R" << endl;
  38. }
  39. else
  40. {
  41. cout << "B" << endl;
  42. }
  43.  
  44. }
  45. return 0;
  46. }
Success #stdin #stdout 0.01s 5324KB
stdin
4


....B...
....B...
....B...
RRRRRRRR
....B...
....B...
....B...
....B...


RRRRRRRB
B......B
B......B
B......B
B......B
B......B
B......B
RRRRRRRB


RRRRRRBB
.B.B..BB
RRRRRRBB
.B.B..BB
.B.B..BB
RRRRRRBB
.B.B..BB
.B.B..BB


........
........
........
RRRRRRRR
........
........
........
........
stdout
R
B
B
R