feat: Initial commit
This commit is contained in:
26
TemiEsame/conta.c
Normal file
26
TemiEsame/conta.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int conta(char *parole[], int nparole, char *cerca) {
|
||||
int s = 0;
|
||||
int l = strlen(cerca);
|
||||
for (int i = 0; i < nparole; i++) {
|
||||
char * prt = parole[i];
|
||||
do {
|
||||
prt = strstr(prt, cerca);
|
||||
|
||||
if (prt != NULL) {
|
||||
prt += l;
|
||||
s++;
|
||||
}
|
||||
|
||||
} while (prt != NULL);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
printf("%d", conta(argv, argc-1, argv[argc-1]));
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user