/C06008 - Loại các từ trùng nhau
<Problem>
https://code.ptit.edu.vn/student/question/C06008#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
int main() {
char s[200];
gets(s);
char arr[100][100];
int len = 0;
const char* delim = " ";
char* token = strtok(s, delim);
while (token != NULL) {
bool check = true;
for (int i = 0; i < len; i++) {
if (strcmp(token, arr[i]) == 0) {
check = false;
break;
}
}
if (check == true) strcpy(arr[len++], token);
token = strtok(NULL, delim);
}
for (int i = 0; i < len; i++) {
printf("%s ", arr[i]);
}
return 0;
}