# 13776 - Doraemon visits NTHU
>author: Utin
###### tags: `string`
---
## Brief
See the code below
## Solution 0
```c=
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char delim[4] = "\n,:";
char ans[1001];
char line[1001];
char key[19] = "UNDER CONSTRUCTION";
char* ptr = ans; // point to the tail of ans
void tran(char* p);
int main() {
char* name, * status;
while (fgets(line, 1001, stdin) != NULL) {
name = strtok(line, delim); // get the first name of line
while (name != NULL) {
status = strtok(NULL, delim); // get the status
tran(status); // transform the status to upper class
// check if the keywords exist or not
if (strstr(status, key) != NULL) {
// if name == line, then there isn't " " before name
if (name == line) {
// check if the place is in the list or not
if (strstr(ans, name) == NULL) {
strcpy(ptr, name); // copy name to ans tail
ptr += strlen(name); // update ptr to ans tail
*ptr = '\n'; // add '\n' behind the place
ptr++; // update ptr to ans tail
}
}
// because we don't set " " as delimeters,
// so the first character of name must be a " "
// we should use name+1 refer to the first character of name
else {
// check if the place is in the list or not
if (strstr(ans, name+1) == NULL) {
strcpy(ptr, name+1); // copy name to ans tail
ptr += strlen(name+1); // update ptr to ans tail
*ptr = '\n'; // add '\n' behind the place
ptr++; // update ptr to ans tail
}
}
}
// get the next name
name = strtok(NULL, delim);
}
}
// output
// ans would be like "place_a\nplace_b\n...place_z\n"
printf("%s", ans);
}
void tran(char* p) {
while (p != NULL && *p != '\0') {
if(*p > 'Z') *p -= 32;
p++;
}
}
// By Utin
```
## Reference