#include #include using namespace std; char ChessBoard[8][8]; void ReadGame(char Offset) { string sep; cin >> sep; char figure, row, col; do { cin >> figure; if (figure >= 'a' && figure <= 'h') { col = figure; figure = 'P'; } else { cin >> col; } cin >> row; ChessBoard[col-'a'][row-'1'] = figure+Offset; } while (getchar()!='\n'); } int main() { for (int y=0;y<8;y++) for (int x=0;x<8;x++) ChessBoard[x][y] = ((x^y)&1) ? '.' : ':'; ReadGame(0); ReadGame('a'-'A'); int x,y = 8; while (1) { for (x=0;x<8;x++) cout << "+---"; cout << '+' << endl; if (!(y--)) break; for (x=0;x<8;x++) { char fill = ((x^y)&1) ? '.' : ':'; cout << '|' << fill << ChessBoard[x][y] << fill; } cout << '|' << endl; } return 0; }