fork(1) download
  1. #include<fstream>
  2. #include<iostream>
  3. #include<cstdio>
  4. #include<vector>
  5. #include<cstring>
  6. #include<algorithm>
  7. #include<cmath>
  8. #define print1(a) printf("%d\n",a);
  9. #define print2(a,b) printf("%d %d\n",a,b);
  10. #define print3(a,b,c) printf("%d %d %d\n",a,b,c);
  11. #define all(c) c.begin(),c.end();
  12. #define loop(i,n) for(i=0;i<n;i++)
  13. typedef long long int ll;
  14. using namespace std;
  15. int main()
  16. {
  17. char str[100003];
  18. char str1[100003];
  19. int i;
  20. while((scanf("%s",str))!=EOF&&scanf("%s",str1)!=EOF)
  21. {
  22.  
  23. int l=strlen(str);
  24. int p=0;
  25. for(i=0;i<l;i++)
  26. {
  27. if(str[i]-'0'<=str1[0]-'0')
  28. cout<<str[i];
  29. else{
  30. if(p==0)
  31. {
  32. cout<<str1;
  33. p=1;
  34. }
  35. cout<<str[i];
  36. }
  37. }
  38. if(p==0)
  39. cout<<str1;
  40. cout<<"\n";
  41.  
  42. }
  43. }
  44.  
Success #stdin #stdout 0s 3416KB
stdin
369
4799
666
12345
stdout
3479969
12345666