题解 | #竞选社长#
竞选社长
https://www.nowcoder.com/practice/45a30e3ef51040ed8a7674984d6d1553
#include <stdio.h> #include <string.h> int main() { int a=0; int b=0; char number; while(scanf("%c",&number)!=EOF){ if(number=='A'){ a++; }else if(number=='B'){ b++; } } if(a>b){ printf("A\n"); }else if(a==b){ printf("E\n"); }else{ printf("B\n"); } return 0; }