题解 | #字符串字符匹配#
字符串字符匹配
https://www.nowcoder.com/practice/22fdeb9610ef426f9505e3ab60164c93
#include <iostream> using namespace std; int main() { string s1, s2; cin >> s1 >> s2; int len = s1.length(); bool flag = true; for(int i = 0; i < len; i++) { int pos = s2.find(s1[i]); if(pos == -1) { flag = false; } } cout << (flag ? "true" : "false") << endl; }