atcoder#ABC284F. [ABC284F] ABCBAC
[ABC284F] ABCBAC
Score : points
Problem Statement
For a string of length and an integer , let us define the string as the concatenation of:
- the first characters of ,
- the reversal of , and
- the last characters of ,
in this order.
For instance, if abc
and , we have abcbac
.
You are given a string of length . Find a pair of a string of length and an integer such that . If no such pair of and exists, report that fact.
Constraints
- is an integer.
- is a string of length consisting of lowercase English letters.
Input
The input is given from Standard Input in the following format:
Output
If no pair of and satisfies the condition, print -1
.
Otherwise, print and , separated by a newline.
If multiple pairs of and satisfy the condition, you may print any of them.
3
abcbac
abc
2
As mentioned in the problem statement, if abc
and , we have abcbac
, which equals , so you should print abc
and .
4
abababab
abab
1
abab
and also satisfy the condition.
3
agccga
cga
0
agc
and also satisfy the condition.
4
atcodeer
-1
If no pair of and satisfies the condition, print -1
.