QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#3639. Eccentric Encryption

Statistics

Mr. Malnar gave a lecture on the Caesar cipher yesterday and concluded that it would be suitable for encrypting his secret messages. However, since it is Mr. Malnar we are talking about, he decided to improve it slightly and created the so-called Malnar cipher. The key consists of three numbers $a, b, c$ ($0 \le a, b, c < 26$). For a given word $S$ consisting of English alphabet letters, Mr. Malnar cyclically shifts the first letter by $a$, the second by $b$, the third by $c$, and then again the fourth by $a$, the fifth by $b$, and so on, until the entire word is encrypted, resulting in a new word $T$.

A cyclic shift by one position transforms the letter 'a' into 'b', 'b' into 'c', and so on, up to 'z' which transforms into 'a'. A cyclic shift by any other natural number is the application of a cyclic shift by one that many times; specifically, a cyclic shift by $0$ does not change any character.

Now, Mr. Malnar is interested in whether, for a pair of words $S$ and $T$, there exists a key such that encrypting the word $S$ with the Malnar cipher results in the word $T$. If such a key exists, please print one.

Input

The first line contains the word $S$ ($3 \le |S| \le 3 \cdot 10^5$). The second line contains the word $T$ ($3 \le |T| \le 3 \cdot 10^5$).

Output

You need to print three numbers $a, b, c$ if such a key exists, or $-1$ if it does not. If there are multiple correct keys, you may print any one of them.

Examples

Input 1

jfbmg
hozmb

Output 1

-1

Input 2

hnjehui
hhmebxi

Output 2

0 20 3

Input 3

abcde
fghj

Output 3

-1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.