Words containing "the" substring: Difference between revisions

Added Swift solution
(→‎{{header|Haskell}}: added solution)
(Added Swift solution)
Line 1,742:
{{out}}
<pre>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|Swift}}==
<lang swift>import Foundation
 
let minLength = 12
let substring = "the"
 
do {
try String(contentsOfFile: "unixdict.txt", encoding: String.Encoding.ascii)
.components(separatedBy: "\n")
.filter{$0.count >= minLength && $0.contains(substring)}
.enumerated()
.forEach{print(String(format: "%2d. %@", $0.0 + 1, $0.1))}
} catch {
print(error.localizedDescription)
}</lang>
 
{{out}}
<pre>
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|Tcl}}==
1,777

edits