func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1000500;   const int INF = 1000000000, mod = 1000000007;   const long long LLINF = 1000000000000000000ll;   char s[N];   int z[N];   int cnt[N];   int n;   void calcZ() {     int l = 0, r = 0;     for (int i = 1; i < n; ++i) {       if (i <= r) {         z[i] = min(z[i - l], r - i + 1);       }       while (i + z[i] < n && s[z[i]] == s[i + z[i]]) {         z[i]++;       }       if (i + z[i] >= r) {         l = i;         r = i + z[i] - 1;       }       cnt[z[i]]++;     }   }   int main() {     scanf( %s , &s);     n = strlen(s);     calcZ();     int cur = 0;     for (int i = n; i >= 1; --i) {       cur += cnt[i];       if (cur >= 2 && z[n - i] == i) {         for (int j = 0; j < i; ++j) {           putchar(s[j]);         }         exit(0);       }     }     puts( Just a legend );     return 0;   }   