HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Functions > problem:


50851 - Repeated Numbers

Guest
• Review clarifications (1)

Volume problems

• 50862 - Sum of the Pairs
• 50904 - Print All Prime Numbers
• 50307 - Palindromes
• 50305 - John's Tasks
• 50315 - Pig Latin
• 50911 - Symmetric Array
• 50296 - Total Discount Rate
• 50935 - Max Discount
• 50851 - Repeated Numbers
• 50838 - Balanced Numbers
• 50724 - Number of Circles
• 50916 - Ascending Numbers
• 50926 - School Mail Merge
• 50917 - Descending Numbers
• 50982 - A thief in labyrinth
• 50980 - The smallest rectangle
• 50932 - Shifting rows and columns

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