HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


50851 - Repeated Numbers

Guest
• Review clarifications (1)

Section problems

• 50529 - Row to Table
• 50499 - Table to Row
• 50990 - Two Neighbors
• 50823 - Secret Number
• 50853 - Parking Place
• 50496 - Falling Bricks
• 50876 - He is my cousin
• 50829 - Decode an Image
• 50851 - Repeated Numbers
• 50838 - Balanced Numbers
• 50515 - Lines - Revisited
• 50913 - Manhattan Distance
• 50824 - Sum of Group Maxes
• 50449 - The biggest result
• 50442 - Polynomial Addition
• 50982 - A thief in labyrinth
• 50989 - Rectangles and Points

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
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