Skip to content

Instantly share code, notes, and snippets.

@amiramke
Created October 2, 2012 21:46
Show Gist options
  • Select an option

  • Save amiramke/3823512 to your computer and use it in GitHub Desktop.

Select an option

Save amiramke/3823512 to your computer and use it in GitHub Desktop.
My Challenge:
Pseudocode:
Script: REVERSE WORDS IN A SENTENCE
GET a sentence from user input
FOR each word in the sentence
REVERSE SINGLE WORD
ENDFOR
PRINT the converted sentence
Gvir's Challenge' solution:
def remove_vowels_if_more_than_2_and_upper()
puts "Enter word:"
original_word = gets.chomp
no_vowels_word = original_word.gsub(/[aAeEoOuUiI]+/,"")
if original_word.length-no_vowels_word.length > 2
return no_vowels_word.upcase
else
return original_word
end
end
puts remove_vowels_if_more_than_2_and_upper()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment