Can anyone help me with what test case I am missing ,It is failing at test case 12,which is very large.Please help. Link to submission: http://codeforces.me/contest/551/submission/59558421
#include<bits/stdc++.h>
using namespace std;
vector<int> cnts(26),cnta(26),cntb(26);
int main(){
string s,a,b;
cin>>s>>a>>b;
for(int i=0;i<a.size();i++){
cnta[a[i]-'a']++;
}
for(int j=0;j<b.size();j++){
cntb[b[j]-'a']++;
}
for(int i=0;i<s.size();i++){
cnts[s[i]-'a']++;
}
int mn=INT_MAX;
for(int i=0;i<26;i++){
if(cnta[i]>0){
mn=min(mn,cnts[i]/cnta[i]);
}
}
for(int i=0;i<26;i++){
cnts[i]=cnts[i]-mn*cnta[i];
}
int mn1=INT_MAX;
for(int i=0;i<26;i++){
if(cntb[i]>0){
mn1=min(mn1,cnts[i]/cntb[i]);
}
}
for(int i=0;i<26;i++){
cnts[i]=cnts[i]-mn1*cntb[i];
}
string ans;
while(mn--){
ans+=a;
}
while(mn1--){
ans+=b;
}
for(int i=0;i<26;i++){
if(cnts[i]){
while(cnts[i]--){
ans+='a'+i;
}
}
}
cout<<ans<<endl;
}