fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. string s[8];
  6. int total=0;
  7. int p=-1;
  8. for(int i=0 ; i<8 ; i++) {
  9. cin >> s[i];
  10. if(s[i]=="BBBBBBBB")total++;
  11. else p=i;
  12.  
  13. }
  14. if(total!=8){
  15. for(int i=0 ; i<8 ; i++){
  16. if(s[p][i]=='B')total++;
  17. }
  18. }
  19. cout << total;
  20. return 0;
  21. }
Success #stdin #stdout 0s 15232KB
stdin
WWWBWWBW
BBBBBBBB
WWWBWWBW
WWWBWWBW
WWWBWWBW
WWWBWWBW
WWWBWWBW
WWWBWWBW
stdout
3