#include #include int a[8][8]; int main(void) { int i,j; char c; int row,col,pie; int end; while (1){ c= getchar(); if (c==':') break; } end = 0; pie = 'P'; while (1) { c = getchar(); if (c>='a' && c<='h') row = c-'a'; else if (c>='1' && c<='8') col = c-'1'; else switch(c){ case ',': end = 1; break; case 'K': case 'Q': case 'N': case 'B': case 'R': pie = c; break; case ' ': break; default: end = 2; } if (end) { a[col][row] = pie; pie = 'P'; if (end == 2) goto end; end = 0; } } end: while (1){ c= getchar(); if (c==':') break; } end = 0; pie = 'P'; while (1) { c = getchar(); if (c>='a' && c<='h') row = c-'a'; else if (c>='1' && c<='8') col = c-'1'; else switch(c){ case ',': end = 1; break; case 'K': case 'Q': case 'N': case 'B': case 'R': pie = c; break; case ' ': break; default: end = 2; } if (end) { a[col][row] = pie+32; pie = 'P'; if (end == 2) goto end2; end = 0; } } end2: printf("+---+---+---+---+---+---+---+---+\n"); for (i=0; i<8; i++) { for (j=0; j<8; j++) { printf("|%c%c%c", ((i^j)&1 ? ':' : '.'), a[7-i][j] ? a[7-i][j] : ((i^j)&1 ? ':' : '.'), ((i^j)&1 ? ':' : '.')); } printf("|\n+---+---+---+---+---+---+---+---+\n"); } return 0; }