문제
Ivana won the bet (Zvonko hadn't foreseen this and suspects that it is due to outside interference) and now Zvonko is waiting for her at the movies. While he is waiting, he is observing messages on a screen above him.
As Ivana is running late, Zvonko has been looking at the screen for a while and noticed that some messages appeared on the screen more than once. Naturally, he's been writing down all messages on a piece of paper. He wants to know the length of the longest string that appeared at least twice (appears in two different positions on the paper).
입력
The first line of input contains an integer (), the length of the string Zvonko wrote down.
The second line contains a string of lowercase letters of the English alphabet.
출력
Output the length of the longest string that appears twice on a single line. If there is no such string, output zero.
예제 입력 1
11
sabcabcfabc
예제 출력 1
3
예제 입력 2
18
trutrutiktiktappop
예제 출력 2
4
예제 입력 3
6
abcdef
예제 출력 3
0
코드를 제출하려면 로그인이 필요합니다.
로그인| # | 순위 | 사용자 | 언어 | 시간 | 메모리 | 코드 길이 | |
|---|---|---|---|---|---|---|---|
| 5665 | 🥇 | 안우진 | Python | 566ms | 54752KB | 622B |
| # | 사용자 | 문제 | 결과 | 언어 | 시간 | 메모리 | 코드 길이 | 제출 시간 | |
|---|---|---|---|---|---|---|---|---|---|
| 5665 | 맞았습니다 | Python | 566ms | 54752KB | 622B | 2026. 04. 28. 21:40 | |||
| 5664 | 틀렸습니다 | Python | - | - | 609B | 2026. 04. 28. 21:39 | |||
| 5663 | 틀렸습니다 | Python | - | - | 613B | 2026. 04. 28. 21:38 | |||
| 5662 | 런타임 에러 | Python | - | - | 712B | 2026. 04. 28. 21:36 | |||
| 5661 | 틀렸습니다 | Python | - | - | 736B | 2026. 04. 28. 21:35 | |||
| 5660 | 틀렸습니다 | Python | - | - | 564B | 2026. 04. 28. 21:29 |