
- Renamed all folders from format NEx (e.g., 1Ex, 2Ex...) to 0NEx (01Ex, 02Ex, etc.) - Updated subdirectories and files accordingly - Removed old main Makefile and tasks (a01.c–a09.c, solve.c, io_status.h), likely obsolete - Cleaned up deprecated task binaries and configs
39 lines
534 B
C
39 lines
534 B
C
#include "solve.h"
|
|
|
|
int t6_solve(char ** a, int n, char *s) {
|
|
int i, j, k;
|
|
for (i = 0, j = 0, k = 0; i < n; ++i) {
|
|
if (strpbrk(a[i], s)) {
|
|
if (k > 1)
|
|
{
|
|
for (int x = 2; x < k; x++) free(a[i - x]);
|
|
a[j++] = a[i - 1];
|
|
}
|
|
|
|
if (i != j)
|
|
{
|
|
a[j] = a[i];
|
|
}
|
|
j++;
|
|
k = 0;
|
|
} else {
|
|
if (k == 0) {
|
|
if (i != j)
|
|
a[j] = a[i];
|
|
j++;
|
|
}
|
|
k++;
|
|
}
|
|
}
|
|
|
|
if (k > 1)
|
|
{
|
|
for (int x = 2; x < k; x++) free(a[i - x]);
|
|
a[j++] = a[i - 1];
|
|
}
|
|
|
|
for (i = j; i < n; ++i) a[i] = 0;
|
|
|
|
return j;
|
|
}
|
|
|