题解 | #计算某字母出现次数#

计算某字母出现次数

http://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1

#include <stdio.h>

char input_words[500];
char select_words;
char select_words2;
int  wordnum=0;

int main()
{
    gets(input_words);
    scanf("%c",&select_words);
    if((select_words>=65)&&(select_words<=90))
    {
        select_words2 = select_words +32;
    }
    else
    {
        select_words2 = select_words -32;
    }
    for(int i=0; input_words[i] != NULL; i++)
    {
        if((select_words == input_words[i])||(select_words2 == input_words[i]))
            wordnum++;
    }
    printf("%d",wordnum);
    return 0;
}
全部评论

相关推荐

1jian10:48h没写面评会变成这样
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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