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