Find words with alternating vowels and consonants: Difference between revisions
Content added Content deleted
m (→{{header|Wren}}: Minor tidy) |
(Initial FB submission for Find words with alternating vowels and consonants) |
||
Line 1,453: | Line 1,453: | ||
recuperate rehabilitate rejuvenate remunerate repetitive reticulate savonarola similitude solicitude tananarive |
recuperate rehabilitate rejuvenate remunerate repetitive reticulate savonarola similitude solicitude tananarive |
||
telekinesis teratogenic topologize unilateral unimodular uninominal verisimilitude |
telekinesis teratogenic topologize unilateral unimodular uninominal verisimilitude |
||
</pre> |
|||
=={{header|FutureBasis}}== |
|||
<syntaxhighlight lang="futurebasic"> |
|||
include "NSLog.incl" |
|||
local fn LoadDictionaryIntoMemory |
|||
CFURLRef url = fn URLWithString( @"http://wiki.puzzlers.org/pub/wordlists/unixdict.txt" ) |
|||
CFStringRef dictStr = fn StringWithContentsOfURL( url, NSUTF8StringEncoding, NULL ) |
|||
AppSetProperty( @"dictionary", dictStr ) |
|||
end fn |
|||
local fn HasAlternatingVowelsAndConsonants( wordStr as CFStringRef ) as BOOL |
|||
NSUInteger i, count = len( wordStr ) |
|||
CFCharacterSetRef vowels = fn CharacterSetWithCharactersInString( @"aeiouAEIOU" ) |
|||
CFMutableCharacterSetRef consonants = fn MutableCharacterSetLetterSet |
|||
MutableCharacterSetRemoveCharactersInString( consonants, @"aeiouAEIOU" ) |
|||
CFCharacterSetRef vowelsInvertedSet = fn CharacterSetInvertedSet( vowels ) |
|||
BOOL isVowelExpected = fn CharacterSetCharacterIsMember( vowelsInvertedSet, fn StringCharacterAtIndex( wordStr, 0 ) ) |
|||
for i = 1 to count - 1 |
|||
unichar chr = fn StringCharacterAtIndex( wordStr, i ) |
|||
BOOL isVowel = fn CharacterSetCharacterIsMember( vowels, chr ) |
|||
if ( (isVowel && isVowelExpected) || (!isVowel && !isVowelExpected) ) |
|||
isVowelExpected = !isVowelExpected |
|||
else |
|||
exit fn = NO |
|||
end if |
|||
next |
|||
end fn = YES |
|||
local fn FindQualifiers |
|||
CFStringRef testWord |
|||
NSUInteger i = 1 |
|||
CFStringRef dictStr = fn AppProperty( @"dictionary" ) |
|||
CFArrayRef dictArray = fn StringComponentsSeparatedByString( dictStr, @"\n" ) |
|||
CFMutableStringRef mutStr = fn MutableStringNew |
|||
for testWord in dictArray |
|||
if ( len( testWord ) > 9 ) |
|||
if ( fn HasAlternatingVowelsAndConsonants( testWord ) ) |
|||
MutableStringAppendString( mutStr, fn StringWithFormat( @"%3d. %@\n", i, testWord ) ) |
|||
i++ |
|||
end if |
|||
end if |
|||
next |
|||
NSLog( @"%@", mutStr ) |
|||
end fn |
|||
fn LoadDictionaryIntoMemory |
|||
fn FindQualifiers |
|||
HandleEvents |
|||
</syntaxhighlight> |
|||
<pre> |
|||
1. aboriginal |
|||
2. apologetic |
|||
3. bimolecular |
|||
4. borosilicate |
|||
5. calorimeter |
|||
6. capacitate |
|||
7. capacitive |
|||
8. capitoline |
|||
9. capitulate |
|||
10. caricature |
|||
11. colatitude |
|||
12. coloratura |
|||
13. colorimeter |
|||
14. debilitate |
|||
15. decelerate |
|||
16. decolonize |
|||
17. definitive |
|||
18. degenerate |
|||
19. deliberate |
|||
20. demodulate |
|||
21. denominate |
|||
22. denotative |
|||
23. deregulate |
|||
24. desiderata |
|||
25. desideratum |
|||
26. dilapidate |
|||
27. diminutive |
|||
28. epigenetic |
|||
29. facilitate |
|||
30. hemosiderin |
|||
31. heretofore |
|||
32. hexadecimal |
|||
33. homogenate |
|||
34. inoperative |
|||
35. judicature |
|||
36. latitudinal |
|||
37. legitimate |
|||
38. lepidolite |
|||
39. literature |
|||
40. locomotive |
|||
41. manipulate |
|||
42. metabolite |
|||
43. nicotinamide |
|||
44. oratorical |
|||
45. paragonite |
|||
46. pejorative |
|||
47. peridotite |
|||
48. peripatetic |
|||
49. polarimeter |
|||
50. recitative |
|||
51. recuperate |
|||
52. rehabilitate |
|||
53. rejuvenate |
|||
54. remunerate |
|||
55. repetitive |
|||
56. reticulate |
|||
57. savonarola |
|||
58. similitude |
|||
59. solicitude |
|||
60. tananarive |
|||
61. telekinesis |
|||
62. teratogenic |
|||
63. topologize |
|||
64. unilateral |
|||
65. unimodular |
|||
66. uninominal |
|||
67. verisimilitude |
|||
</pre> |
</pre> |
||
=={{header|Go}}== |
=={{header|Go}}== |