#include void replace(char *); int main(void) { int idx, i, j; char str[101], replaced[101]; char tree[] = "treeone"; idx = i = 0; scanf("%s", str); while(str[i] != '\0'){ j = 0; if(str[i] == tree[0]){ for(j = 1; tree[j] != '\0'; j++){ if(str[i + j] == tree[j]){ }else{ break; } } } if(j >= 7){ replace(&replaced[idx]); idx += 6; i += 7; }else{ replaced[idx++] = str[i++]; } } printf("%s\n", replaced); return 0; } void replace(char *s) { int i; char forest[] = "forest"; for(i = 0; i < 6; i++){ s[i] = forest[i]; } }