eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Rotate Text Blocks

Rotate Text Blocks

Given a rectangular block of text, your task is to rotate it counter-clockwise by \textbf{90°}, and print the result. \InputFile The first input line contains the number of test cases \textbf{N}, \textbf{1} ≤ \textbf{N} ≤ \textbf{50}. Each test case begins with a line containing integers \textbf{h} and \textbf{w}, separated by space. \textbf{h} lines follow. Each line \textbf{i}, \textbf{1} ≤ \textbf{ih} ≤ , contains a length-\textbf{w} strings \textbf{s_i}. The text block \textbf{s_1}, \textbf{s_2}, ..., \textbf{s_h}, when stacked vertically, specifies the input text block. \begin{itemize} \item \textbf{h} is the height of the text block, and satisfies \textbf{1} ≤ \textbf{h} ≤ \textbf{50}. \item \textbf{w} is the width of the text block, and satisfies \textbf{1} ≤ \textbf{w} ≤ \textbf{50}. \item For each \textbf{i}, \textbf{1} ≤ \textbf{i} ≤ \textbf{h}, \textbf{s_i} is a length-\textbf{w} string of upper/lower case alphabets ("\textbf{A}"-"\textbf{Z}", "\textbf{a}"-"\textbf{z}") or periods "\textbf{.}". \end{itemize} \OutputFile For each test case, rotate the input text block counter-clockwise by \textbf{90°}, and print it as \textbf{w} lines of length-\textbf{h} strings. Print an empty line between test cases, but not after the last test case.
Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
2
2 3
Hel
lo.
1 1
X
Вихідні дані #1
l.
eo
Hl

X
Джерело University of Toronto 2010 ACM Tryout: Saturday, October 2, 2010