Help me in solving ALTTAB problem

My issue

plz fix the error…code is running properly ,i guess due to T_cmplx & S_cmplx

My code

#include <bits/stdc++.h>

using namespace std;


int main() {
	// your code goes here
    	int n;
    	cin>>n;
	    unordered_map<string,int>mp;
	    vector<string> s(n);
	    string ans="";
	    
	    for(int i=0;i<n;i++){
	        cin>>s[i];
	    }
	    
	       for(int i=n-1;i>0;i--){
	        string strpy=s[i];
	        // initially mp is empity 
	        if(mp.find(strpy)!=mp.end()){
	            continue; // when we found repeated string in mp we just move to next string--->and we started string n-1 bcz in que we print first that come in last until get unique string  
	        }
	        else{
	            mp[strpy]++; // take input
	            ans+=strpy[strpy.length()-2];
	            ans+=strpy[strpy.length()-1];
	            
	        }
	    }
	    cout<<ans<<endl;
	  
	
	return 0;
}

Problem Link: ALTTAB Problem - CodeChef

@deepakjdh31
The for loop will be from n-1 till 0 and u have did n-1 till >0