#include #include #include #include #include #include #include #include #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; string s; cin >> s; int n = s.size(); vector ord(n); auto ok = [&](){ for(int i = 0; i < n; i++){ if(ord[i] == 0 && s[i] != '?') return false; } return true; }; for(int j = 1; !ok(); j++){ vector appear(26); for(int i = n-1; i >= 0; i--){ if(s[i] == '?') continue; if(ord[i] != 0) continue; bool f = true; for(int k = s[i]-'a'+1; k < 26; k++){ if(appear[k]) f = false; } if(f) ord[i] = j; appear[s[i]-'a'] = true; } } vector v; int mx = *max_element(ord.begin(), ord.end()); if(mx == 0) mx = 1; for(int i = 0; i < n; i++){ if(ord[i] == mx) v.push_back(i); } for(int i = 0; i < n; i++){ if(s[i] == '?'){ auto p = lower_bound(v.begin(), v.end(), i); if(p == v.end()) s[i] = 'a'; else s[i] = s[*p]; } } cout << s << endl; }