ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Linear Data Structures: Arrays > задача:


50851 - Repeated Numbers

Гость
• Вопросы к жюри (1)

Задачи раздела

• 50990 - Two Neighbors
• 50496 - Falling Bricks
• 51021 - Number of Nodes
• 50829 - Decode an Image
• 51044 - Number of Trees
• 50876 - He is my cousin
• 51098 - Rotate a matrix
• 50838 - Balanced Numbers
• 50851 - Repeated Numbers
• 51061 - The Longest Path
• 51083 - Grades Histogram
• 51084 - Reflect a matrix
• 51011 - Decoding the Path
• 50515 - Lines - Revisited
• 51088 - Number of letters
• 50913 - Manhattan Distance
• 51125 - Filling an Array 3

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 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

Для отправки решений необходимо выполнить вход.

www.contester.ru