F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Chessmen

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 1050    Accepted Submission(s): 115


Problem Description
You know, Harry, Ron, and Hermione thought they had found some Snape's cabal. They tried to tail after Snape until they went into a strange room.
The room was so dark they couldn't see anything at all. But as they stepped into it, light suddenly flooded the room to reveal an astonishing sight.
They were standingon the edge of a huge chessboard, behind the black chessmen, which were all taller than they were and carved from what looked like black stone. Facing them, way across the room, were the white pieces. Harry, Ron and Hermione shivered slightly - the towering white chessmen had no faces.
'Now what do we do?' harry whispered.
'It's obvious, isn't it?' said Ron. 'We've got to play our way across the room.'
Behind the white pieces they could see another door.
'How?' said Hermione nervously.
'I think,' said Ron, 'we're going to have to be chessmen.'
He walked up to a black knight and put his hand out to touch the knight's horse. At once, the stone sprang to life. The horse pawed the ground and the knight turned his helmeted head to look down at Ron.
'Do we - er - have to join you to get across?'
The black knight nodded. Ron turned to the other two.
'This wants thinking about ...' he said. 'I suppose we've got to take the place of the back pieces ...'
Harry and Hermione stayed quiet, watching Ron think. Finally he said, 'Now, don't be offended or anything, but neither of you are that good at chess -'
'We're not offended,' said Harry quickly. 'Just tell us what to do.'
'Well, Harry, you take the place of that bishop, and Hermione, you go next to him instead of that castle.'
'What about you?'
'I'm going to be a knight,' said Ron.
The chessmen seemed to have been listening, because at these words a knight, a bishop and a castle turned there backs on the white pieces and walked off the board leaving three empty squares which Harry, Ron and Hermione took.
'White always plays first in chess,' said Ron,peering across the board. 'Yes ... look ...'
A white pawn had moved forward two squares.


Now Ron decided to direct the black pieces, but he met a trouble. All the chessmen were so tall that he can't know the whole board. He must memorize the board all by himself if you don't help him. Could you write a magic for him?
 

Input
The input will contain several chess manuals. Each one is in the format as sample input.
O-O and O-O-O will not appear.
Notice that black side may haven't a move in the last turn.
The input will always be correct,and end of -1.
 

Output
Print the chessboard in FEN.
(see also the Hint)
 

Sample Input
0 Pe2-e4 pd7-d5 1 Pd2-d3 pf7-f5 2 Pf2-f3 pe7-e6 3 Pe4xd5 pe6xd5 4 Pc2-c4 pd5xc4 5 Pd3xc4 qd8-e7 6 Ng1-e2
 

Sample Output
rnb1kbnr/ppp1q1pp/8/5p2/2P5/5P2/PP2N1PP/RNBQKB1R In the FEN (Forsyth-Edwards Notation), a chessboard is described as follows: The Board-Content is specified starting with the top row and ending with the bottom row. Character / is used to separate data of adjacent rows. Each row is specified from left to right. White pieces are identified by uppercase piece letters: PNBRQK. Black pieces are identified by lowercase piece letters: pnbrqk. Empty squares are represented by the numbers one through eight. A number used represents the count of contiguous empty squares along a row. Each row's sum of numbers and characters must equal 8. For example: [i][b]5k1r/2q3p1/p3p2p/1B3p1Q/n4P2/6P1/bbP2N1P/1K1RR3[/b][/i] is the FEN notation description of the following chessboard: [center][img]/data/images/C6-1005.gif[/img][/center] The chessboard of the beginning of a chess game is described in FEN as: [i][b]rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR[/b][/i]
 

Hint
Hint
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 00:44:31, Gzip enabled