题解 | #竞选社长#
竞选社长
http://www.nowcoder.com/practice/45a30e3ef51040ed8a7674984d6d1553
解法二:
(我的解法都是用最朴素的C语言写的,基本功)
include<stdio.h>
int main()
{
int a = 0;
int b = 0;
char ch = 0;
while (scanf("%c", &ch) != EOF)
{
if (ch == '0')
break;
if (ch == 'A')
a++;
if (ch == 'B')
b++;
}
if (a > b)
printf("A");
if(a<b)
printf("B");
if(a==b)
printf("E");
return 0;
}