some programs!
This commit is contained in:
1 parent
5d30e847c1
commit
ed054247d5
32 files changed
+1882
-149
No files matched your search
@@ -0,0 +1,29 @@
|
||||
#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;
|
||||
}
|
||||
Reference in new issue
Block a user