Hello everyone!

Yesterday I read this problem (https://a2oj.com/p?ID=3), and after that, it showed to me that there is a waste of some information that the solver needs to solve it.

But, surely, several unaccessible accepted submissions, made me incline to accuse my understanding.

So I, gratefully, hope you to help me in this problem.

After you read the problem statement, see this please:

Are there, in the statement, expressions that describe the **whole** way to construct the *expansion* string from the *poly-line* ( *initial* ) string? I saw that there is not enough clear explanation for it. So, all of the ways are considered true, but according to the examples, not all of the ways to construct the expansion string are accepted!!. Thanks in advance.

Auto comment: topic has been updated by MahmoudAlio (previous revision, new revision, compare).Based on what I've read, there is exactly one way to construct the expansion string.

For each pair of consecutive letters in the initial string, you need to draw a line, starting at the center of the first letter and going directly to the center of the second letter. The expansion string is formed by the letters written in the buttons touched.

Example for string ACM:

Then, the buttons touched in the order of initial string are: ABCBHGNM. That's the expansion.

Ahaaa (☆.☆)

I thought that we should move just in the vertical and horizontal directions (up, right, down and left).

But truely I should be careful to use all the information given in the problem, like this:

"

Note that a poly-line which touches only the boundaries of a square does not count as a touch, for example a segment going from 'A' to 'H' does not touch 'B' or 'G'".Anyway, Thank you very very much for your real help ♡.