30 lines
563 B
C++
30 lines
563 B
C++
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
string inserted_string(string s, const string& sub_s) {
|
|
int max_char_pos = -1;
|
|
char max_char = 0;
|
|
for (int i = 0; i < s.size(); i++) {
|
|
if (s[i] > max_char) {
|
|
max_char = s[i];
|
|
max_char_pos = i;
|
|
}
|
|
}
|
|
s.insert(max_char_pos + 1, sub_s); // STL 偷懒
|
|
return s;
|
|
}
|
|
|
|
int main() {
|
|
ios::sync_with_stdio(false);
|
|
cin.tie(nullptr);
|
|
|
|
string s, sub_s;
|
|
|
|
while (cin >> s >> sub_s) {
|
|
cout << inserted_string(s, sub_s) << endl;
|
|
}
|
|
|
|
return 0;
|
|
}
|