2nd_Sem_Bogachev/2025.02.21/3Ex/solve.c
2025-03-02 14:38:34 +03:00

20 lines
270 B
C

#include "solve.h"
int t3_solve(char ** a, int n, char *s) {
int i, j;
for (i = 0, j = 0; i < n; ++i) {
if (strpbrk(s, a[i])) {
if (i != j)
{
a[j] = a[i];
}
j++;
} else {
free(a[i]);
}
}
for (i = j; i < n; ++i) a[i] = 0;
return j;
}