题解 | #字符串字符匹配#
字符串字符匹配
https://www.nowcoder.com/practice/22fdeb9610ef426f9505e3ab60164c93
#include <iostream> #include <bits/stdc++.h> using namespace std; // stl includes 判断子集合 int main() { string s1, s2; while (getline(cin, s1)) { // 注意 while 处理多个 case while (getline(cin, s2)) { set<char> st1, st2; for (char ch : s1) { st1.insert(ch); } for (char ch : s2) { st2.insert(ch); } if (includes(st2.begin(), st2.end(), st1.begin(), st1.end())) { cout << "true" << endl; } else { cout << "false" << endl; } } } }