题解 | 字符串字符匹配
#include <iostream> #include <string> #include <unordered_map> using namespace std; int main() { unordered_map<char,char> hash; string s,t; cin>>s; cin>>t; int i = 0,j = 0; int sl = (int)s.length(); int tl = (int)t.length(); for(i = 0; i<tl; i++){ hash.insert({t[i], t[i]}); } for(j = 0; j<sl; j++){ auto got = hash.find(s[j]); if(got == hash.end()){ cout<< "false"<<endl; return 0; } } cout<< "true" <<endl; return 0; } // 64 位输出请用 printf("%lld")