func_code_string: #include <bits/stdc++.h>   int main() {     std::ios_base::sync_with_stdio(false);     std::string s;     std::cin >> s;     int n = s.length();     std::vector<int> prefix_fun(n, 0);     for (int i = 1; i < n; i++) {       int j = prefix_fun[i - 1];       while (j > 0 && s[i] != s[j]) {         j = prefix_fun[j - 1];       }       if (s[i] == s[j]) {         j++;       }       prefix_fun[i] = j;     }     if (prefix_fun[n - 1] == 0) {       std::cout <<  Just a legend ;       return 0;     }     for (int i = 1; i < n - 1; i++) {       if (prefix_fun[i] == prefix_fun[n - 1]) {         std::cout << s.substr(0, prefix_fun[i]);         return 0;       }     }     int j = prefix_fun[prefix_fun[n - 1] - 1];     if (j == 0) {       std::cout <<  Just a legend ;       return 0;     }     std::cout << s.substr(0, j);     return 0;   }   