23A.md (799B)
1 Source: https://codeforces.com/problemset/problem/23/A 2 3 A. You're Given a String... 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 You're given a string of lower-case Latin letters. Your task is to find the length of its longest substring that can be met in the string at least twice. These occurrences can overlap (see sample test 2). 22 23 Input 24 25 The first input line contains the string. It's guaranteed, that the string is non-empty, consists of lower-case Latin letters, and its length doesn't exceed 100. 26 27 Output 28 29 Output one number — length of the longest substring that can be met in the string at least twice. 30 31 Examples 32 33 Input 34 35 ``` 36 abcd 37 ``` 38 39 Output 40 41 ``` 42 0 43 ``` 44 45 Input 46 47 ``` 48 ababa 49 ``` 50 51 Output 52 53 ``` 54 3 55 ``` 56 57 Input 58 59 ``` 60 zzz 61 ``` 62 63 Output 64 65 ``` 66 2 67 ```