Towers P71268


Statement
 

pdf   zip

html

Write a program that reads chessboards where there only are rooks and, for each chessboard, indicates how many threats there are.

Input

Input consists of a natural n, followed by n chessboards. Each board consists of 8 rows of eight characters each one. A |’.’| indicates a free position. A |’R’| indicates a position occupied by a rook. Each board has, at least, a rook.

Output

For each rook, from top to bottom and from left to right, print which rooks it threatens to. The threats also must appear sorted from top to bottom and from left to right. If a rook does not threaten any other, indicate it. (Follow the format of the instance.) Print an empty line afters the output of each chessboard.

Public test cases
  • Input

    2
    
    R...R...
    ........
    ........
    ........
    ........
    ........
    ........
    ..R.....
    
    ........
    ........
    ........
    ...RR..R
    ...RR...
    ........
    ........
    ........
    

    Output

    
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++