blob: 7f301e03a9584d351e69c7f91bfb77413aa70b94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ifstream cin("whereami.in");
ofstream cout("whereami.out");
int N;
cin >> N;
string S;
cin >> S;
for (int K = 1; K <= N; ++K) {
bool good = true;
for (int a = 0; a <= N - K; ++a) {
for (int b = 0; b <= N - K; ++b) {
if (a == b) continue;
bool string_equal = true;
for (int i = 0; i <= K - 1; ++i) {
if (S[a + i] != S[b + i]) string_equal = false;
}
if (string_equal) good = false;
}
}
if (good) {
cout << K;
return 0;
}
}
}
|