I'm working on making a word game with my friend, but ran into this
problem I can't solve.

So say I have the string:

example = "stringy"

And the array:

ex_array = ['estrange', 'gingerly', 'stop', 'geek', 'dry', 'rad', 'ear',
'wrinkle', 'cringy', 'guy', 'stringwingy']

Now, I want to iterate each letter of "stringy" through this array.....
s-t-r-i-n-g-y....

The loop should return the words from the array that meet the following
conditions:

1) Contain more than 1 consonant (assuming y is a consonant)

2) Returns a match to any consecutive group of character in the
"stringy" (ex. 'st', 'str', 'stri'..etc)

3) Displays the groups of phrases that can be matched from inside of the
array, leaving no letter in the "string" unaccounted for.

4) Displays a count of total number of matches at the bottom.

Desired output from the example above: # text to the right of # is not
to be printed by the loop

estrange gingerly # str ingy MATCH
stop cringy # st ringy MATCH
stop wrinkle guy # st rin gy MATCH
stringywingy # stringy MATCH
Total: 4 matches

---
# geek, dry, rad, ear are not a match for any consecutive (min 2)
letters in 'stringy'
# 'ear' has too many consonants
# estrange cringy is not a match because the 'r' overlaps


Is there a way to get this done with nested for loops, or any other more
efficient way?

Thanks ;)

-- 
Posted via http://www.ruby-forum.com/.