题解 | #字符串字符匹配#

字符串字符匹配

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

#include <stdio.h>
#include <string.h>
int main() {
    char s[201]={0};
    char t[201]={0};
    scanf("%s",s);
    scanf("%s",t);
    int len1=strlen(s);
    int len2=strlen(t);
    int map[127]={0};
    for(int i=0;i<len2;i++)
    {
        map[t[i]]++;
    }
    int count=0;
    for(int i=0;i<len1;i++)
    {
        if(map[s[i]]!=0)
        count++;
    }
    if(count==len1)
    printf("true\n");
    else
    printf("false\n");
    return 0;
}

全部评论

相关推荐

09-29 00:03
门头沟学院 Java
点赞 评论 收藏
分享
做个有文化的流氓:不想当将军的士兵不是好士兵
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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