Words containing "the" substring: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (→{{header|BCPL}}: fix off by one bug caused by also counting the newline) |
Not a robot (talk | contribs) (Add C) |
||
Line 401: | Line 401: | ||
{{out}} |
{{out}} |
||
<pre style='height:50ex;'>authenticate |
<pre style='height:50ex;'>authenticate |
||
chemotherapy |
|||
chrysanthemum |
|||
clothesbrush |
|||
clotheshorse |
|||
eratosthenes |
|||
featherbedding |
|||
featherbrain |
|||
featherweight |
|||
gaithersburg |
|||
hydrothermal |
|||
lighthearted |
|||
mathematician |
|||
neurasthenic |
|||
nevertheless |
|||
northeastern |
|||
northernmost |
|||
otherworldly |
|||
parasympathetic |
|||
physiotherapist |
|||
physiotherapy |
|||
psychotherapeutic |
|||
psychotherapist |
|||
psychotherapy |
|||
radiotherapy |
|||
southeastern |
|||
southernmost |
|||
theoretician |
|||
weatherbeaten |
|||
weatherproof |
|||
weatherstrip |
|||
weatherstripping</pre> |
|||
=={{header|C}}== |
|||
<lang c>#include <stdio.h> |
|||
#include <string.h> |
|||
int main() { |
|||
char word[128]; |
|||
FILE *f = fopen("unixdict.txt","r"); |
|||
if (!f) { |
|||
fprintf(stderr, "Cannot open unixdict.txt\n"); |
|||
return -1; |
|||
} |
|||
while (!feof(f)) { |
|||
fgets(word, sizeof(word), f); |
|||
// fgets() includes the \n character, so we need to test |
|||
// for a length of 12 (11 letters plus the newline) |
|||
if (strlen(word) > 12 && strstr(word,"the")) |
|||
printf("%s",word); |
|||
} |
|||
fclose(f); |
|||
return 0; |
|||
}</lang> |
|||
{{out}} |
|||
<pre style="height:50ex;">authenticate |
|||
chemotherapy |
chemotherapy |
||
chrysanthemum |
chrysanthemum |