Guest User

Untitled

a guest
Jul 18th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. #include <string>
  6. #include <algorithm>
  7.  
  8. using namespace std;
  9.  
  10. string answer(string& A, string& B) {
  11. int i;
  12. for(i=0; i<A.size(); ++i)
  13. if(A[i] > B[0]) break;
  14. string result = A.substr(0, i) + B + A.substr(i, A.size()-i);
  15. return result;
  16. }
  17.  
  18. int main() {
  19.  
  20. #ifndef ONLINE_JUDGE
  21. freopen("5120_MINSEQ.in", "r", stdin);
  22. freopen("5120_MINSEQ.out", "w", stdout);
  23. #endif
  24.  
  25. char buff1[100001], buff2[100001];
  26. while(scanf("%s %s", buff1, buff2)!=EOF) {
  27. string str1 = buff1, str2 = buff2;
  28. printf("%s\n", answer(str1, str2).c_str());
  29. }
  30. return 0;
  31. }
Add Comment
Please, Sign In to add comment