Language: C++

using namespace std;

int main(int argc, char const* argv[])
{
    string s;
    cin>>s;
    int len = s.size();
    char ans[len];
    for (int i = len; i > 0; i--) {
        if(s[i]!='z') ans[i] = 'z';
        else if(s[i]!='y') ans[i] = 'y';
        else if(s[i]!='x') ans[i] = 'x';
        else if(s[i]!='w') ans[i] = 'w';
        else if(s[i]!='v') ans[i] = 'v';
        else if(s[i]!='u') ans[i] = 'u';
        else if(s[i]!='t') ans[i] = 't';
        else if(s[i]!='s') ans[i] = 's';
        else if(s[i]!='r') ans[i] = 'r';
        else if(s[i]!='q') ans[i] = 'q';
        else if(s[i]!='p') ans[i] = 'p';
        else if(s[i]!='o') ans[i] = 'o';
        else if(s[i]!='n') ans[i] = 'n';
        else if(s[i]!='m') ans[i] = 'm';
        else if(s[i]!='l') ans[i] = 'l';
        else if(s[i]!='k') ans[i] = 'k';
        else if(s[i]!='j') ans[i] = 'j';
        else if(s[i]!='i') ans[i] = 'i';
        else if(s[i]!='h') ans[i] = 'h';
        else if(s[i]!='g') ans[i] = 'g';
        else if(s[i]!='f') ans[i] = 'f';
        else if(s[i]!='e') ans[i] = 'e';
        else if(s[i]!='d') ans[i] = 'd';
        else if(s[i]!='c') ans[i] = 'c';
        else if(s[i]!='b') ans[i] = 'b';
        else if(s[i]!='a') ans[i] = 'a';
    }
    for (int i = 0; i < len-1; i++) {
        for (int j = i+1; j < len; j++) {
            if(s[j]==s[i]){
                cout<<"-1"<<endl;
                return 0;
            }
        }
    }
    for (int i = 0; i < len; i++) {
        cout<<s[i];
    }
    cout<<ans[0]<<endl;
    return 0;
}

              

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:5:5: error: 'string' was not declared in this scope
    5 |     string s;
      |     ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | using namespace std;
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin>>s;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:6:10: error: 's' was not declared in this scope
    6 |     cin>>s;
      |          ^
a.cc:40:17: error: 'cout' was not declared in this scope
   40 |                 cout<<"-1"<<endl;
      |                 ^~~~
a.cc:40:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:40:29: error: 'endl' was not declared in this scope
   40 |                 cout<<"-1"<<endl;
      |                             ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:46:9: error: 'cout' was not declared in this scope
   46 |         cout<<s[i];
      |         ^~~~
a.cc:46:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:48:5: error: 'cout' was not declared in this scope
   48 |     cout<<ans[0]<<endl;
      |     ^~~~
a.cc:48:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:48:19: error: 'endl' was not declared in this scope
   48 |     cout<<ans[0]<<endl;
      |                   ^~~~
a.cc:48:19: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'