Слова
Існують тести які містять пробіли в словах,символи з кодом>256 і про них не сказано нічого в умові задачі.
include <bits/stdc++.h>
using namespace std; bool f1(string soz,string hisse){ int say=0; map<char,int>m1; for(char c:soz){ m1[c]++; } for(char c:hisse){ if(m1.find(c)==m1.end()|| m1[c]==0){
return false;
}
m1[c]--; } return true;
}
int main() { iosbase::syncwith_stdio(false); cin.tie(nullptr); string soz,hisse; cin>>soz; int n; cin>>n; int a; int say=0; for(int i=0; i<n;i++){ cin>>hisse; bool t=f1(soz,hisse); if(t==true){ say++; }
}
cout<<say;
}
include <bits/stdc++.h>
using namespace std; bool f1(string soz,string hisse){ int say=0; map<char,int>m1; for(char c:soz){ m1[c]++; } for(char c:hisse){ if(m1.find(c)==m1.end()|| m1[c]==0){
return false;
}
m1[c]--; } return true;
}
int main() { iosbase::syncwith_stdio(false); cin.tie(nullptr); string soz,hisse; cin>>soz; int n; cin>>n; int a; int say=0; for(int i=0; i<n;i++){ cin>>hisse; bool t=f1(soz,hisse); if(t==true){ say++; }
}
cout<<say;
}