<s> import re , sys <EOL> import chess <EOL> def fen_to_piece_placement_array ( fen ) : <EOL> piece_placement = fen . split ( ) [ <NUM_LIT:0> ] <EOL> piece_placement_array = [ list ( line ) for line in piece_placement . split ( "<STR_LIT:/>" ) ] <EOL> piece_placement_array1 = [ ] <EOL> for line in piece_placement_array : <EOL> new_line = [ ] <EOL> for char in line : <EOL> try : <EOL> number = int ( char ) <EOL> new_line . extend ( [ <NUM_LIT:1> ] * number ) <EOL> except : <EOL> new_line . append ( char ) <EOL> piece_placement_array1 . append ( new_line ) <EOL> return piece_placement_array1 <EOL> def find_from_to ( piece , from_piece_placement_array , to_piece_placement_array ) : <EOL> from_location = ( ) <EOL> to_location = ( ) <EOL> for i in xrange ( <NUM_LIT:8> ) : <EOL> for j in xrange ( <NUM_LIT:8> ) : <EOL> if to_piece_placement_array [ i ] [ j ] != from_piece_placement_array [ i ] [ j ] : <EOL> if piece == from_piece_placement_array [ i ] [ j ] : <EOL> from_location = ( i , j ) <EOL> if piece == to_piece_placement_array [ i ] [ j ] : <EOL> to_location = ( i , j ) <EOL> return from_location , to_location <EOL> def main ( argv ) : <EOL> '''<STR_LIT>''' <EOL> for line in sys . stdin : <EOL> try : <EOL> piece , from_fen , to_fen = line . split ( "<STR_LIT:\t>" ) <EOL> to_piece_placement_array = fen_to_piece_placement_array ( from_fen ) <EOL> from_piece_placement_array = fen_to_piece_placement_array ( to_fen ) <EOL> from_location , to_location = find_from_to ( piece , from_piece_placement_array , to_piece_placement_array ) <EOL> print "<STR_LIT>" % ( piece , from_location [ <NUM_LIT:0> ] , from_location [ <NUM_LIT:1> ] , to_location [ <NUM_LIT:0> ] , to_location [ <NUM_LIT:1> ] ) <EOL> except : <EOL> pass <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> sys . stderr . write ( "<STR_LIT>" % sys . argv ) <EOL> main ( sys . argv ) </s>
