#include #include using namespace std; #include #include char x[255][100]; char y[255][100]; int wp=0,bp=0; void get(int z, bool &n) { if (n) printf(","); int p; for (p=0;p<10;p++) { if (x[z][p] == -1) { if (p==0) n = false; return; } if (z != 'P') { printf("%c",z); } printf("%c",char((x[z][p]+'a'))); printf("%c",char((7-y[z][p])+'1')); if (x[z][p+1]!=-1) printf(","); n = true; } } void getb(int z,bool &n) { int p; if (n) printf(","); for (p=0;p<10;p++) { if (x[z][p] == -1) { if (p==0) n = false; return; } if (z != 'p') { printf("%c",z-'a'+'A'); } /* char zz += z-'a'+'A';*/ printf("%c",char((x[z][p]+'a'))); printf("%c",char((7-y[z][p])+'1')); if (x[z][p+1]!=-1) printf(","); n=true; } } /*int g(int z) { switch(z) { 'K': return 0; 'Q': return 1; 'R': return 2; 'B': return 3; 'N': return 4; } }*/ int main() { int s,t; for (s=0;s<255;s++) { for (t=0;t<100;t++) x[s][t] = -1; y[s][t]= -1; } // char tmp[1000]; string tmp[8]; for (s=0;s<8;s++) { cin >> tmp[s]; cin >> tmp[s]; } for (s=0;s<8;s++) { /*scanf("%s",tmp); printf("%s\n",tmp); scanf("%s",tmp); printf("%s\n",tmp);*/ int pos; int t; for (t=0;t<8;t++) { pos = (t+1)*4-2; int c = tmp[s][pos]; if (c<'a'||c>'z') continue; int l=0; while(x[c][l]!=-1) l++; x[c][l] = t; y[c][l] = s; } } for (s=7;s>=0;s--) { /*scanf("%s",tmp); printf("%s\n",tmp); scanf("%s",tmp); printf("%s\n",tmp);*/ int pos; int t; for (t=0;t<8;t++) { pos = (t+1)*4-2; int c = tmp[s][pos]; if (c<'A'||c>'Z') continue; int l=0; while(x[c][l]!=-1) l++; x[c][l] = t; y[c][l] = s; } } bool nn=false; printf("White: "); get('K',nn); get('Q',nn); get('R',nn); get('B',nn); get('N',nn); get('P',nn); printf("\n"); nn=false; printf("Black: "); getb('k',nn); getb('q',nn); getb('r',nn); getb('b',nn); getb('n',nn); getb('p',nn); printf("\n"); return 0; }