- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREPSTR.cpp
More file actions
Latest commit
29 lines (23 loc) · 576 Bytes
/
Copy pathREPSTR.cpp
File metadata and controls
29 lines (23 loc) · 576 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include<bits/stdc++.h>
usingnamespacestd;
#defineFor(i, a, b) for(int i = a; i <= b; i++)
#defineFord(i, a, b) for(int i = a; i >= b; i--)
#definelllonglong
#definehere cout<<"I am Here"<<endl;
intconst maxn = 1000000;
intconst base = 1e9 + 7;
char Ar[maxn], S[maxn];
intmain(void){
cin>>Ar>>S;
int N = strlen(S), M = strlen(Ar);
sort(S, S + N);
int j = N - 1;
For(i, 0, M - 1){
if(Ar[i] < S[j]){
Ar[i] = S[j];
j--;
}
}
cout<<Ar;
return0;
}