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