注意set本身就是去重,而且自动升序排序,unordered_set没有顺序,也是去重的。
#include <algorithm>
#include <set>
using namespace std;
int main() {
string shorts,longs;
while(cin>>shorts>>longs){
bool has=true;
set<char> cset;
for(auto c:longs){
cset.insert(c);
}
for(auto a:shorts){
if(!cset.count(a))
{has = false; break;}
}
cout<<boolalpha<<has;
}
}