HTML & JS
 #include "bits/stdc++.h"
using namespace std;
string to_string(string s) {
  return '"' + s + '"';
}
string to_string(const char* s) {
  return to_string((string) s);
}
string to_string(bool b) {
  return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifndef ONLINE_JUDGE
#define show(...) cerr << "[" << #__VA_ARGS__ << "] :", debug_out(__VA_ARGS__)
#else
#define show(...) 42
#endif
#define f first
#define s second
#define endl "\n"
#define pb push_back
#define  oo 0x3f3f3f3f
#define limit 1003
#define two pair<int,int>
#define ll long long int
#define int long long int
#define mod(x,m) ((x%m+m)%m)
#define all(v) v.begin(),v.end()
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define fori(x,n) for(int i = x; i < n; i++)
#define forj(y,m) for(int j = y; j < m; j++)
#define fork(z,p) for(int k = z; k < p; k++)
#define make_it_fast std::ios::sync_with_stdio(false)
#define watch(x) cerr << (#x) << " is " << (x) << "\n"
#define input_from_file  freopen("input.txt", "r", stdin);
#define output_to_file  freopen("output.txt", "w", stdout);
#define m 1000000009
#define no 311
 
int val(char s){
  return s+1;
}
 
signed main(){
//input_from_file;
make_it_fast;
int n; cin>>n;
vector<string> v(n);
fori(0,n) cin>>v[i];
string ans = "";
fori(0,n){
   map<int,int> mp;
   int len1 = v[i].size();
   show(len1);
   int tmp = 0;
   int power = 1;
   forj(0,len1){
     tmp = (tmp+power*val(v[i][j]))%m;
     power *= no , power %= m;
     mp[tmp]++;
   }
   int len2 = ans.size();
   int idx = 0; tmp = 0;
   for(int j=1;j<=len1&&len2-j>=0;j++){
     tmp = (tmp*no+val(ans[len2-j]))%m;
     if(mp[tmp] > 0) idx = j;
    }
    ans += v[i].substr(idx,len1);
    mp.clear();
   }
   show(ans.size());
  cout<<ans<<endl;
}

Generated URL:

Runtime Errors:

Abort signal from abort(3) (SIGABRT)

Output:

No Output
Report Bug