Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <string>
- #include <algorithm>
- using namespace std;
- string answer(string& A, string& B) {
- int i;
- for(i=0; i<A.size(); ++i)
- if(A[i] > B[0]) break;
- string result = A.substr(0, i) + B + A.substr(i, A.size()-i);
- return result;
- }
- int main() {
- #ifndef ONLINE_JUDGE
- freopen("5120_MINSEQ.in", "r", stdin);
- freopen("5120_MINSEQ.out", "w", stdout);
- #endif
- char buff1[100001], buff2[100001];
- while(scanf("%s %s", buff1, buff2)!=EOF) {
- string str1 = buff1, str2 = buff2;
- printf("%s\n", answer(str1, str2).c_str());
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment