题解 | #字符串字符匹配#
字符串字符匹配
https://www.nowcoder.com/practice/22fdeb9610ef426f9505e3ab60164c93
#include <bits/stdc++.h> using namespace std; int main() { string str1, str2; getline(cin, str1); getline(cin, str2); int l1 = str1.length(); int l2 = str2.length(); int count = 0; for (int i = 0; i < l1; i++) { for (int j = 0; j < l2; j++) { if (str1[i] == str2[j]) { ++count; break; } } } if (count == l1) cout << "true" << endl; else cout << "false" << endl; }