|
| 1 | +#include <cstring> |
| 2 | +#include <map> |
| 3 | +#include <deque> |
| 4 | +#include <queue> |
| 5 | +#include <stack> |
| 6 | +#include <sstream> |
| 7 | +#include <numeric> |
| 8 | +#include <iostream> |
| 9 | +#include <iomanip> |
| 10 | +#include <cstdio> |
| 11 | +#include <cmath> |
| 12 | +#include <fstream> |
| 13 | +#include <string> |
| 14 | +#include <cstdlib> |
| 15 | +#include <ctime> |
| 16 | +#include <functional> |
| 17 | +#include <algorithm> |
| 18 | +#include <vector> |
| 19 | +#include <set> |
| 20 | +#include <complex> |
| 21 | +#include <list> |
| 22 | +#include <climits> |
| 23 | +#include <cctype> |
| 24 | +#include <bitset> |
| 25 | +using namespace std; |
| 26 | + |
| 27 | +#define PI 3.14159265359 |
| 28 | +#define all(v) v.begin(),v.end() |
| 29 | +#define sortva(v) sort(all(v)) |
| 30 | +#define sortvd(v) sort(v.rbegin(),v.rend()) |
| 31 | +#define sortaa(a,n) sort(a,a+n) |
| 32 | +#define sortad(a,n) sort(a,a+n),reverse(a,a+n) |
| 33 | +#define sfi1(v) scanf("%d",&v) |
| 34 | +#define sfi2(v1,v2) scanf("%d %d",&v1,&v2) |
| 35 | +#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3) |
| 36 | +#define sfll1(v) scanf("%I64d",&v); |
| 37 | +#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2) |
| 38 | +#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3) |
| 39 | +#define sfstr(v) scanf("%s", v); |
| 40 | +#define sz(v) (int)v.size() |
| 41 | +#define ndl puts("") |
| 42 | +#define flush fflush(stdout) |
| 43 | +#define SS stringstream |
| 44 | +typedef long long ll; |
| 45 | +typedef unsigned long long ull; |
| 46 | +typedef long double ld; |
| 47 | + |
| 48 | +int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 }; |
| 49 | +int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 }; |
| 50 | + |
| 51 | +ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); } |
| 52 | +ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; } |
| 53 | + |
| 54 | +void PLAY() { |
| 55 | +#ifndef ONLINE_JUDGE |
| 56 | +freopen("input.txt", "r", stdin); |
| 57 | +freopen("output.txt", "w", stdout); |
| 58 | +#endif |
| 59 | + |
| 60 | +cout << fixed << setprecision(10); |
| 61 | +ios::sync_with_stdio(0); |
| 62 | +cin.tie(0); |
| 63 | +cout.tie(0); |
| 64 | +} |
| 65 | + |
| 66 | +int main() { |
| 67 | +PLAY(); |
| 68 | + |
| 69 | +int n; |
| 70 | +string s; |
| 71 | + |
| 72 | +cin >> n >> s; |
| 73 | + |
| 74 | +int cur = 0; |
| 75 | +for (int i = 1; i < n; i++) |
| 76 | +if (s.substr(0, i) == s.substr(i, i)) |
| 77 | +cur = i - 1; |
| 78 | + |
| 79 | +cout << n - cur << endl; |
| 80 | + |
| 81 | +return 0; |
| 82 | +} |
0 commit comments