#include using namespace std; typedef long long ll; #define rep(i,n) for(i=0;i>s; int ct[10]={0}; ct[0]=-1; s[1]='0'; rep(i,s.size()) ++ct[s[i]-'0']; int x=-1,y=-1; rep(i,10){ if(ct[i]>a[i]) x=i; if(ct[i]