commit 78820229fb30ca6c4634a1f73fd70552a0dcf719
parent 07ad464dbe7965ca28c4c11da83a9afe901e5ce0
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Wed, 26 Aug 2015 22:14:15 +0200
comment
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/only3.py b/only3.py
@@ -10,11 +10,15 @@ for l in sys.stdin.readlines():
f[1] = f[1].strip()
parse = re.split(vowels_regexp, f[1])
parse = [x for x in parse if len(x) > 0]
+ # count number of vowel sounds
s = sum([1 for x in parse if x[0] in vowels])
if s != 3:
continue
+ # words cannot start with a vowel
+ # as last consonant before last vowel will be kept
if parse[0][0] in vowels:
continue
+ # sound preceding the last vowel sound must be a consonant
if parse[-1][0] in vowels and parse[-2][0] in vowels:
continue
if (parse[-1][0] not in vowels and parse[-2][0] in vowels