Perfect pairs 751
Statement
Goal
Let's consider the following manipulation. We start at n = 12. The square of 12 is 144. Reversing the digits of 144 we obtain 441. The square root of 441, m = 21, is, in this example, also an integer.If the previous manipulation starting at an integer n yields another integer m, then we say that (n, m) is a perfect pair. For example,
You will be given a number n and you have to assess if it is the left element of a perfect pair. If it is, give the right member of the pair. If it isn't, output
Input
Line 1: A positive integer n.
Output
An integer m such that (n, m) is a perfect pair. If there isn't such m, the string None .
Constraints
1 <= n <= 10 ** 6
Example
Input
12
Output
21
Game modes
Fastest, Shortest
Test cases
Example Test
Input
12
Output
21
Validator 1 Validator
Input
21
Output
12
1 digit Test
Input
1
Output
1
Validator 2 Validator
Input
3
Output
3
Small 1 Test
Input
33
Output
99
Validator 3 Validator
Input
13
Output
31
Small 2 Test
Input
112
Output
211
Validator 4 Validator
Input
264
Output
264
Medium 1 Test
Input
2121
Output
1212
Validator 5 Validator
Input
2636
Output
2636
Medium 2 Test
Input
101003
Output
300101
Validator 6 Validator
Input
211111
Output
111112
None Test
Input
7869
Output
None
Validator 7 Validator
Input
6876
Output
None
Big 1 Test
Input
990000
Output
33
Validator 8 Validator
Input
650100
Output
3168
Big 2 Test
Input
798644
Output
798644
Validator 9 Validator
Input
310000
Output
13
Solution language
Solution
Stub generator input