Submission #3617

#TimeUsernameProblemLanguageResultExecution timeMemory
3617waps12bMake superpalindrome! (kriii1_M)C++98
Compilation error
0 ms0 KiB
#include<string> #include<iostream> using namespace std; //s보다 사전순 같거나 앞에 있으면서 슈퍼팰린드롬 string make(string s){ //1인 경우는 볼 필요 없다. if(s.length() == 1) return s; int len = s.length(); bool sw = false; for(int i=0; i< (len+1)/2;i++){ char &l = s[i]; char &r = s[len - i - 1]; if( l < r ) sw = true; r = l; } if(sw){ for(int i= (len+1)/2 -1; i>=0; i--){ char &l = s[i]; char &r = s[len - i - 1]; if( l != 'z'){ r = ++l; break; } l = r = 'a'; } } string ans = make(s.substr(0,len/2)); string ar = ans; reverse(ar.begin(),ar.end()); if(len&1){ if(ans > s.substr(0,len/2)){ s[(len)/2] = 'a'; } return ans + s[(len)/2] + ar; } return ans + ar; } int main(){ string s; cin >> s ; cout << make(s) << endl; return 0; }

Compilation message (stderr)

M.cpp: In function 'std::string make(std::string)':
M.cpp:34:29: error: 'reverse' was not declared in this scope