fork download
  1. #include <stdio.h>
  2. int str_count(char *str, int c);
  3.  
  4. int main(void){
  5. char a[10];
  6. char b;
  7. scanf("%c",&b);
  8. for(int i=0;i<10;i++){
  9. scanf("%*c%c",&a[i]);
  10. }
  11. printf("検索文字の数%d",str_count(&a,b));
  12. return 0;
  13. }
  14. int str_count(char *str, int c){
  15. int b=0;
  16. for(int i=0;i<10;i++){
  17. if(str[i]==c){
  18. b++;
  19. }
  20. }
  21. return b;
  22. }
Success #stdin #stdout 0s 5512KB
stdin
s s s a a s d f s f g
stdout
検索文字の数4