字符串判断

#include <stdio.h>
#include <string.h>
int main() {
    char str1[51], str2[51];
    scanf(&quot;%50s&quot;, str1); 
    scanf(&quot;%50s&quot;, str2); 
    for (int i = 0; str1[i] != '\0'; i++) {
        for (int j = 0; str2[j] != '\0'; j++) {
            if (str1[i] == str2[j]) {
                printf(&quot;yes\n&quot;);
                return 0;
            }
        }
    }
    printf(&quot;no\n&quot;); 
    return 0;
}
全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

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