#include #include using namespace std; typedef struct figure { int type; int x; int y; } figure; int main() { string Line; figure Figures[32]; int Count = 0; for (int y=7;y>=0;y--) { cin >> Line; cin >> Line; for (int x=0;x<8;x++) { char c = Line[2+4*x]; int type; switch (c|' ') { case 'k': type = 1; break; case 'q': type = 2; break; case 'r': type = 3; break; case 'b': type = 4; break; case 'n': type = 5; break; case 'p': type = 6; break; default: type = 0; } if (!(c&' ') && type) { Figures[Count].type = type; Figures[Count].x = x; Figures[Count++].y = y; } if (c&' ' && type) { Figures[Count].type = type; Figures[Count].x = x; Figures[Count++].y = -(y+1); } } } for (int i=Count-1;i>0;i--) for (int j=i;j b.type || (a.type == b.type && (a.y > b.y || (a.y == b.y && a.x > b.x)))) { Figures[j] = a; Figures[j-1] = b; } } cout << "White: "; bool sep = false; for (int i=0;i= 0) { if (sep) cout << ','; sep = true; switch (Figures[i].type) { case 1: cout << 'K'; break; case 2: cout << 'Q'; break; case 3: cout << 'R'; break; case 4: cout << 'B'; break; case 5: cout << 'N'; break; } cout << (char)(Figures[i].x+'a') << (char)(Figures[i].y+'1'); } cout <