Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Question by Ibrahim Mesecan.
Repeated Numbers
Because the number 142 is repeated twice, assume that the
number 142142 is called as a repeated number. And, because
repeating number 142 is a 3-digit number, 142142 may be called
3rd degree repeated number. 345346 is not a repeated number
because no part of the number is repeated. Similarly, 5555
is a repeated number with the degree of 1.
Question:
Write a program that takes a number. And then,
it decides the degree of the repeated number.
Input specification:
Firstly, you will be an integer (n) length of the number.
Then in the next line, you will have the number
where 1 ≤ n ≤ 2000.
Output specification:
Show the minimum degree of repeated number. Show -1,
if there is no repetition in the number.
Sample Input I
4
5555
|
Sample Input II
6
323323
|
Sample Output I
1
|
Sample Output II
3
|
Для отправки решений необходимо выполнить вход.
|