题解 | #竞选社长#
竞选社长
https://www.nowcoder.com/practice/45a30e3ef51040ed8a7674984d6d1553
#include <stdio.h> int main() { char arr[1000]; gets(arr); int a = 0; int b = 0; int i = 0; while (arr[i] != '\0') { if (arr[i] == 'A') { a++; } if (arr[i] == 'B') { b++; } i++; } if ( a > b) { printf("A"); } if ( a < b) { printf("B"); } if (a == b) { printf("E"); } return 0; }