Language: C++

abcdefghijklmnopqrstuvw
abcdefghijklmnopqrstuvx#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,a,b) for (int i = (a); i < (b); i++ )
typedef pair<int,int> P;
typedef long long ll;
const int INF = 100000000;
const double PI=3.14159265358979323846;

int main (){
    string S;
    cin >> S;

    if (S.size()<26) {

        rep(i,0,26) {
            char ans = 'a'+i;
            bool tmp=true;
            rep(j,0,S.size()) {
                if (S[j]==ans) {
                    tmp = false;
                }
            }
            if (tmp){
                cout << S << ans << endl;
                break;
            }
        }
    }
    else if (S == "zyxwvutsrqponmlkjihgfedcba") {
        cout << -1 << endl;
    }

    else {
        string T = S;
        next_permutation(S.begin(),S.end());
        rep(i,0,S.size()) {
            if (T[i]==S[i]){
                continue;
            }
            else {
                rep(j,0,i+1) {
                    cout << S[j];
                }
                cout << endl;
                break;
            }
        }
    }

}



Compiler output:
a.cc:2:24: error: stray '#' in program
    2 | abcdefghijklmnopqrstuvx#include <bits/stdc++.h>
      |                        ^
a.cc:1:1: error: 'abcdefghijklmnopqrstuvw' does not name a type
    1 | abcdefghijklmnopqrstuvw
      | ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:4:15: error: 'vector' does not name a type
    4 | using Graph = vector<vector<int>>;
      |               ^~~~~~
a.cc:6:9: error: 'pair' does not name a type
    6 | typedef pair<int,int> P;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:12:5: error: 'string' was not declared in this scope
   12 |     string S;
      |     ^~~~~~
a.cc:13:5: error: 'cin' was not declared in this scope
   13 |     cin >> S;
      |     ^~~
a.cc:13:12: error: 'S' was not declared in this scope
   13 |     cin >> S;
      |            ^
a.cc:26:17: error: 'cout' was not declared in this scope
   26 |                 cout << S << ans << endl;
      |                 ^~~~
a.cc:26:37: error: 'endl' was not declared in this scope
   26 |                 cout << S << ans << endl;
      |                                     ^~~~
a.cc:32:9: error: 'cout' was not declared in this scope
   32 |         cout << -1 << endl;
      |         ^~~~
a.cc:32:23: error: 'endl' was not declared in this scope
   32 |         cout << -1 << endl;
      |                       ^~~~
a.cc:36:15: error: expected ';' before 'T'
   36 |         string T = S;
      |               ^~
      |               ;
a.cc:37:9: error: 'next_permutation' was not declared in this scope
   37 |         next_permutation(S.begin(),S.end());
      |         ^~~~~~~~~~~~~~~~
a.cc:39:17: error: 'T' was not declared in this scope
   39 |             if (T[i]==S[i]){
      |                 ^
a.cc:44:21: error: 'cout' was not declared in this scope
   44 |                     cout << S[j];
      |                     ^~~~
a.cc:46:17: error: 'cout' was not declared in this scope
   46 |                 cout << endl;
      |                 ^~~~
a.cc:46:25: error: 'endl' was not declared in this scope
   46 |                 cout << endl;
      |                         ^~~~