题解 | #竞选社长#

竞选社长

https://www.nowcoder.com/practice/45a30e3ef51040ed8a7674984d6d1553

#include <stdio.h>

int main() {
    char str[100]={0};
    int a=0,b=0;
    for(int i=0;str[i]!='0';i++)
    {
        scanf("%c",&str[i]);
        if(str[i]=='A')
            a++;
        else if(str[i]=='B')
            b++;
    }
    if(a>b)
        printf("A");
    else if(a<b)
        printf("B");
    else
        printf("E");
    return 0;
}

全部评论

相关推荐

Elastic90:公司不要求加班,但 又不允许你准点下班,经典又当又立
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务