General

# Author Problem Lang Verdict Time Memory Sent Judged
71215931 Practice:
noscope_kid
1304B - 22 GNU C++17 Wrong answer on test 8 15 ms 160 KB 2020-02-16 13:35:24 2020-02-16 13:35:24

→ Source
#include<bits/stdc++.h>
using namespace std;
int main(){
int n ,m;
cin >> n >>m;
vector <string> sfinal;
vector <string> s;
for(int i=0;i<n;i++){
string k;
cin >> k;
s.push_back(k);
}
for(int i=0;i<s.size();i++){
string a;
a=s[i];
reverse(a.begin(),a.end());
vector <string>::iterator it=find(s.begin()+i+1,s.end(),a);
if(it!=s.end()){
sfinal.push_back(s[i]);
vector <string>::iterator temp=next(s.begin(),i);
s.erase(temp);
s.erase(it-1);
}
}
string mid;

for(int i=0;i<s.size();i++){
string a;
a=s[i];
reverse(a.begin(),a.end());
if(a.compare(s[i])==0){
mid=a;
break;
}
}
string final;
for(int i=0;i<sfinal.size();i++){
final=final+sfinal[i];
}
string finalr;
finalr=final;
reverse(finalr.begin(),finalr.end());
final=final+mid;
final=final+finalr;
cout << final.size() <<endl;
cout << final <<endl;
}

?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
?
?
?