For this Question: Our Tono has got N cute strings. Cute strings are very loving, and they possess a beautiful property. Whenever two cute strings are placed next to each other, they get concatenated in the following manner:
"tono"+"nolo"="tonolo" (suffix-prefix match occurs once). See sample for better understanding.

Now, Tono wants to concatenate these N cute strings from left to right. Can you help her find the merged string.The first line contains an integer N, the number of strings.
The next line contains N strings consisting of only lowercase english letters.

Constraints
1 <= N <= 100000
1 <= sum of lengths of all strings <= 500000

(String matching takes O(N) time, try to analyze the time complexity of your solution)Output a single string, the answer to Tono's problem.Sample Input
5
i want to eat truffle

Sample Output
iwantoeatruffle

Explanation
i + want = iwant
iwant + to = iwanto
iwanto + eat = iwantoeat
iwantoeat + truffle = iwantoeatruffle, I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
#define MOD 1000000007
#define INF 1000000000000000007
#define MAXN 300005

// it's swapnil07 ;)

void getZ(string str, int Z[]) 
{ 
    int n = str.length(); 
    int L, R, k; 
    L = R = 0; 
    for (int i = 1; i < n; ++i) 
    { 
        if (i > R) 
        { 
            L = R = i; 
            while (R<n && str[R-L] == str[R]) 
                R++; 
            Z[i] = R-L; 
            R--; 
        } 
        else
        { 
            k = i-L; 
            if (Z[k] < R-i+1) 
                Z[i] = Z[k]; 
            else
            { 
                L = i; 
                while (R<n && str[R-L] == str[R]) 
                    R++; 
                Z[i] = R-L; 
                R--; 
            } 
        } 
    } 
}

signed main(){
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int n; cin>>n;
    string ans;
    cin>>ans;
    string s1, s2;
    For(i, 0, n-1){
        int v = ans.length();
        cin>>s2;
        int len = min(ans.length(), s2.length());
        s1 = ans.substr(v-len);
        string s = s2+"$"+s1;
        int Z[s.length()];
        getZ(s, Z);
        int av = 0;
        for(int j=0; j<len; j++){
            int x = j+1;
            if(Z[s.length()-x]==x){
                av = x;
            }
        }
        s2 = s2.substr(av);
        ans += s2;
    }
    cout<<ans;
    return 0;
}

, In this Programming Language: C++, Now tell me if this Code is compilable or not?