Second Numbers
InterviewTime limit2sMemory limit1024 MB
Given n, check whether its decimal digits can be split into two parts that are both primes without leading zeros.
- Level
Easy3 of 10
- Topics
- Math, Number theory, String
- Solved
- No attempts yet
Problem
In mathematics, a prime number is a natural number with exactly two distinct divisors, 1 and itself. The smallest primes are 2, 3, 5, and 7.
Jasio learned this definition in a math lesson and immediately made up a new one. A natural number is called a second number when it has at least two digits and its decimal representation can be formed by writing two prime numbers side by side. Neither of those primes may have leading zeros.
For example, 232 is a second number, because it is the concatenation of the representations of two primes: 23 and 2. On the other hand, 2017 is not a second number, since it cannot be built by writing two primes next to each other without leading zeros.
Your task is to check whether the number given as input is a second number.
Input
The first and only line of input contains a single integer ().
Output
Print a single word: TAK if is a second number, or NIE otherwise.