/C06022 - Xóa từ trong xâu
<Problem>
https://code.ptit.edu.vn/student/question/C06022#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <ctype.h>
int main() {
int t;
scanf("%d", &t);
getchar();
for (int test = 1; test <= t; test++) {
char s[200];
char s2[20];
gets(s);
gets(s2);
for (int i = 0; i < strlen(s2); i++) {
s2[i] = tolower(s2[i]);
}
char arr[100][100];
int n = 0;
const char* delim = " ";
char* token = strtok(s, delim);
while (token != NULL) {
char tmp[200];
strcpy(tmp, token);
for (int i = 0; i < strlen(token); i++) {
token[i] = tolower(token[i]);
}
if (strcmp(token, s2) != 0) strcpy(arr[n++], tmp);
token = strtok(NULL, delim);
}
printf("Test %d: ", test);
for (int i = 0; i < n; i++) {
printf("%s ", arr[i]);
}
printf("\n");
}
return 0;
}