HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN303 2013-15 Questions > problem:


15FE-01. 50851 - Repeated Numbers

CEN303 2013-15 Questions

Start: Dec.15.2013 at 02:00:00 PM
Finish: Dec.15.2013 at 07:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 14-Fall1-60. 50784 - Top Growing C...
• 14-Fall2-10. 50751 - The biggest Mi...
• 14-Fall2-20. 50794 - Writing Files Int...
• 14-Fall2-30. 50490 - Across the River
• 14-Fall2-40. 50772 - The Path of a N...
• 14-Fall2-50. 50681 - Center of a Series
• 14-FallResit-10. 50525 - Ordering Pizza
• 14-FallResit-20. 50488 - Connecting...
• 15FE-01. 50851 - Repeated Nu...
• 15FE-01. 50838 - Balanced Numbers
• 15FE-04. 50997 - Dynamic Knights
• 15HW-10. 50826 - Olive Containers
• 15HW-30. 50828 - Arranging Time ...
• 15HW-40. 50676 - Cinema Millennium
• 15HW-40. 50829 - Decode an Image
• 15HW-50. 50830 - Sorting BST Nodes
• 15HW-60. 50678 - The Jumping Rabbit

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