题解 | 竞选社长

竞选社长

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

#include <stdio.h>

int main() {
    char poll;
    int countA =0,countB=0;
    while ((poll = getchar()) != '0') {
        if(poll == 'A') countA++;
        else if(poll == 'B') countB++;
    }
    if(countA > countB) printf("A");
    else if(countA < countB) printf("B");
    else printf("E");
    
    return 0;
}

全部评论

相关推荐

04-15 20:51
门头沟学院 Java
纳斯卡可:把名字改一下吧 千万级用户你真测过吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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