题解 | 字符串字符匹配

字符串字符匹配

https://www.nowcoder.com/practice/22fdeb9610ef426f9505e3ab60164c93

#include <iostream>
#include <set>
using namespace std;

int main() {
    string s, t;
    getline(cin, s);
    getline(cin, t);
    set<char> char_set;
    for(const char& c : s)
        char_set.insert(c);
    for(const char& c : t)
        char_set.erase(c);
    
    if(char_set.empty()){
        cout << "true" << endl;
    }else{
        cout << "false" << endl;
    }

    return 0;
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

那一天的Java_J...:看工资定规模,钱多就叫大厂
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务