Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC optimize ("O3")
- #pragma GCC target ("sse4")
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- typedef pair<int, int> pii;
- typedef pair<string,int> psi;
- typedef map<int,int> mii;
- typedef map<long long,long long> mll;
- typedef map<string,int> msi;
- typedef map<char,int> mci;
- typedef set<int> si;
- typedef set<long long> sll;
- typedef set<string> ss;
- typedef set<char> sc;
- typedef vector<int> vi;
- typedef vector<string> vs;
- typedef vector<char> vc;
- typedef vector<ll> vll;
- typedef vector<vector<int>> vvi;
- typedef vector<vector<string>> vvs;
- typedef vector<vector<ll>> vvll;
- #define FOR(i, a, b) for (auto i=a; i<=(b); i++)
- #define FORd(i,b,a) for (int i =b; i >= a; i--)
- #define sz(x) (int)(x).size()
- #define mp make_pair
- #define pb push_back
- #define f first
- #define s second
- #define ins insert
- const int MOD = 1000000007;
- //type functions here
- int main() {
- int tc=1;
- //cin>>tc;
- FOR(w,1,tc)
- {
- mci m1,m2;
- string s1="a",s2="a";
- //cin>>s1>>s2;
- for(auto x:s1) m1[x]++;
- for(auto x:s2) m2[x]++;
- for(auto x:m2) m1[x.f]-=x.s;//deleting the pattern chars from the big string
- string s="";
- int flag=0;
- for(auto x:m1)
- {
- while(x.s)
- {
- s+=x.f;
- x.s--;
- }
- if(x.f>=s2[0]&&flag==0)
- {s+=s2;
- flag=1;
- }
- }
- cout<<s<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement