144 字符串中A的数量.c 235 B

1234567891011121314
  1. #include <stdio.h>
  2. int main() {
  3. char s[100] = {0};
  4. scanf("%s", s);
  5. int i = 0;
  6. while (s[i++]);
  7. int n = 0;
  8. for (int j = 0; j < i; ++j) {
  9. if (s[j] == 'A') n++;
  10. }
  11. printf("%d\n", n);
  12. return 0;
  13. }