Created
August 1, 2013 23:33
-
-
Save boxmein/6136291 to your computer and use it in GitHub Desktop.
How often have you asked yourself: Is there some silly word that shares letters with most of the names of the states of the US?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
states = %w(Alabama Alaska Arizona Arkansas California Colorado | |
Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa | |
Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota | |
Mississippi Missouri Montana Nebraska Nevada NewHampshire NewJersey | |
NewMexico NewYork NorthCarolina NorthDakota Ohio Oklahoma Oregon | |
Pennsylvania RhodeIsland SouthCarolina SouthDakota Tennessee Texas Utah | |
Vermont Virginia Washington WestVirginia Wisconsin Wyoming) | |
ARGV.each do |word| | |
states.each do |state| | |
if not /[#{Regexp.quote(state.downcase)}]/ =~ word.downcase then | |
puts word + " is not in: " + state | |
end | |
end | |
end | |
# Small Ruby solution for the question: | |
# What is a word that shares letters with a very large amount of US states? | |
# ex. mackerel shares no letters only with Ohio | |
# by boxmein 2013. Use freely. | |
# Usage: mackerel.rb <words...> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment