Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- void formalize(char* s) {
- if(s[strlen(s)-1]== 10) {
- s[strlen(s)-1] = '\0';
- }
- }
- int main() {
- char T[1000];
- int Q=0;
- char P[20];
- fgets(P,20,stdin);
- formalize(P);
- while(true) {
- fgets(T,100,stdin);
- formalize(T);
- if(strcmp(T,"#") == 0) {
- break;
- }
- else {
- while(strstr(T,P) != NULL) {
- ++Q;
- char* x = strstr(T,P);
- *x = ' ';
- }
- }
- }
- printf("%d\n",Q);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement