mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-11-27 08:26:20 +00:00
22 lines
267 B
C
22 lines
267 B
C
|
#include <stdio.h>
|
||
|
|
||
|
char c, s[100];
|
||
|
|
||
|
int main() {
|
||
|
gets(s);
|
||
|
scanf("%c", &c);
|
||
|
|
||
|
int len = strlen(s);
|
||
|
int cnt = 0;
|
||
|
|
||
|
for (int i = 0; i < len; i++) {
|
||
|
if (s[i] == c) {
|
||
|
cnt++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
printf("%d\n", cnt);
|
||
|
|
||
|
return 0;
|
||
|
}
|