Words containing "the" substring: Difference between revisions

Added Go
(Added Wren)
(Added Go)
Line 152:
weatherstrip
weatherstripping</pre>
 
=={{header|Go}}==
<lang go>package main
 
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"strings"
"unicode/utf8"
)
 
func main() {
wordList := "unixdict.txt"
b, err := ioutil.ReadFile(wordList)
if err != nil {
log.Fatal("Error reading file")
}
bwords := bytes.Fields(b)
var words []string
for _, bword := range bwords {
s := string(bword)
if utf8.RuneCountInString(s) > 11 {
words = append(words, s)
}
}
count := 0
fmt.Println("Words containing 'the' having a length > 11 in", wordList, "\b:")
for _, word := range words {
if strings.Contains(word, "the") {
count++
fmt.Printf("%2d: %s\n", count, word)
}
}
}</lang>
 
{{out}}
<pre>
Words containing 'the' having a length > 11 in unixdict.txt:
1: authenticate
2: chemotherapy
3: chrysanthemum
4: clothesbrush
5: clotheshorse
6: eratosthenes
7: featherbedding
8: featherbrain
9: featherweight
10: gaithersburg
11: hydrothermal
12: lighthearted
13: mathematician
14: neurasthenic
15: nevertheless
16: northeastern
17: northernmost
18: otherworldly
19: parasympathetic
20: physiotherapist
21: physiotherapy
22: psychotherapeutic
23: psychotherapist
24: psychotherapy
25: radiotherapy
26: southeastern
27: southernmost
28: theoretician
29: weatherbeaten
30: weatherproof
31: weatherstrip
32: weatherstripping
</pre>
 
=={{header|Julia}}==
Line 223 ⟶ 296:
weatherstripping
</pre>
 
 
 
 
=={{header|Raku}}==
9,490

edits