-->
当前位置:首页 > 题库

PROGRAMMING:Hello World for You Again

Luz5年前 (2021-05-10)题库621
Welcome to the 18th China Jiliang University Programming Contest, the first task for you is so easy, isn't it?
Given any string of $$N$$ ( ≥ $$5$$ ) characters, you are asked to form the characters into the shape of U. For example, `helloworld` can be printed as:
```
h d
e l
l r
lowo
```
That is, the characters must be printed in the original order, starting top-down from the left vertical line with $$n_ 1$$ characters, then left to right along the bottom line with $$n_ 2$$ characters, and finally bottom-up along the vertical line with $$n_ 3$$ characters.
And more, we would like U to be as squared as possible -- that is, it must be satisfied that $$n_ 1=n_ 3=max$$ { $$k$$ | $$k$$ ≤ $$n_ 2$$ for all $$3$$ ≤ $$n_ 2$$ ≤ $$N$$ } with $$n_ 1+n_ 2+n_ 3-2=N$$.
### Input Specification:
There are multiple test cases. Each case contains one string with no less than $$5$$ and no more than $$100$$ characters in a line. The string maybe contains one or more white spaces.
### Output Specification:
For each test case, print the input string in the shape of U as specified in the description.
### Sample Input:
```in
helloworld!
hello world
```
### Sample Output:
```out
h !
e d
l l
lowor
h d
e l
l r
lo wo
```







answer:If there is no answer, please comment