Given a four-letter word, re-arrange the letters and send it off to the next person on your email list. You can change (replace with a different) one letter. No duplicate words allowed, no proper names, etc.
When there are over 100 words, how does one check for duplicates? Each potential solution – and there will no doubt be many – needs to be compared to the list to assure there are no matches.
The code:
- Count the words in the “Late Night Scrabble” email/social virus.
module Enumerable
def dups
inject({}) {|h,v| h[v]=h[v].to_i+1; h}.reject{|k,v| v==1}.keys
end
end
File.open ‘late.scrabble’ do |file|
@werds = []
while line = file.gets
werd = line.split(" – ")
puts werd0.downcase
@werds << werd
end
puts @werds.dups.inspect
end
The words:
WORD:
rare – Donal, Greybull, WY
rate – Linda, Park City, UT
date – Delana, Cheyenne, Wy
late – Emily Denver, CO
gate – Malia, Arvada, CO
fate – Beth, Littleton, CO
fare – Pam, Colorado Springs, CO
farm – Heather, Littleton, CO, January 7, 2009
firm – Sarah Sebewaing, MI
form – Rebecca, Unionville, MI, 1-7-09
fort – Christine, Crown Point, IN, 1-8-09
sort – Deb, Crown Point, IN, 1-8-09
tore – Joan, Crown Point, IN, 1-8-09
tire – Barbara, Crown Point, IN, 1/08/09
fire – Sara, Crown Point, IN, 1/8/09
wire – Patty, Culver, IN, 1/12/09
dire – Lucy, Crown Point, IN, 1/12/09
dirt – Ann, Portage Indiana, 1/12/09
riot – Judi, Naples, FL, 1/13/09
root – Jana, Empire, MI, 1/14/09
room – Victoria, Traverse City, MI, 1/16/09
loom – Bonny, Traverse City, MI, 1/16/09
loam – Melinda, Bear Lake MI, 1/17/09
roam – Shawn, Clarkston, MI, 1/18/09
foam – Michelle, Clarkston, MI, 1/19/09
foal – Teresa Seidel, W. Bloomfield, MI, 1/20/09
goal – Vickie, Brighton, MI, 1/21/09
goat – Becky, Westland, MI, 1/21/09
boat – Joyce, Bloomfield Hills, MI, 1/21/09
moat – Jane, E. Lansing, MI, 1/23/09
moot – Susan. Okemos, MI, 1/23/09
mood – jenny, HK, 1/23/09
good – Charlene, Hingham, Ma, 1/23/2009
hood – Annmarie, Naples, FL, 1/23/2009
food – Myriam, Naples FL, 1/23/09
wood – Louis, Middletown NY, 20090124
word – Russ, Suffern NY, 1/25/09
worm – Laurie, Suffern, NY, 1/25/09
wore – Mary, Bronx, NY, 1/25/09
pore – Annette, Carmel, IN, 1/26/09 (formerly from the Bronx )
Lore – Debby Jo, Indianapolis, IN, 1/26/09
love – Nancy, Indianapolis, IN, 1/27/09
dove – Mimi, Indianapolis, IN, 1/27/09
mode – Joline, Indianapolis, IN, 1/27/09
code – Rick, Carmel, IN, 1/27/09
bode – Jim, Indianapolis, IN, 1/27/09
body – Cynthia, Indianapolis, IN, 1/27/09
bony – Sally, Indianapolis, IN, 2/03/09
pony – Pat, Goodyear, AZ, 2/4/09
puny – Joan, Jacksonville, FL, 2/4/09
punt – Sue, Bellevue, WA 2/4/09
unit – Val, Bellevue, WA 2/4/09
tins – Kay, Kirkland, WA 2/05/09
nits – Sandra, Centralia, WA, 2-6-09
pits – Nancy, River Vale, NJ, 2-9-9
pets – Pam, Farmington, CT, 2/10/09
pots – Gail, Brookfield, WI, 2/11/09
lots – Greg, Brookfield, WI, 2/11/09
tots – Dick, Fort Atkinson, Wi, 2/11/09
bots – Jeff, Fort Atkinson, wi, 02/’25/09
bats – Tony, Fort Atkinson WI, 02/25/09
rats – Don, Columbus, WI, 02/25/09
cats – Pat, Columbus, WI, 02/25/09
stay – Ruth, Ann Keen, St. Germain WI
stag – Karl, Spencer, Va.
star – Kelly, Bassett, VA, 02-26-09
scar – Alissa, Bassett, VA, 02/27/2009
cast – Lyndee, Bassett, VA, 2/27/09
last – Katina, Martinsville,VA, 2/28/09
task – Mark, VA, 3/1/09
bask – Paula, Martinsville, VA, 03/01/09
mask – gill, nc, 3-1-09
mast – pal, nc, 3/1/09
spam – John, MS, 3/2/09
spay – Carol, Memphis TN
days – Bobbie, Memphis, TN, by way of FL
pays – Sue, Nashville, TN via FL
says – Judy, Kirkwood, MO
lass – Lisa, Manchester, CT, 4/23/09
last – Gloria, Windsor, CT, 4/23/09
silt – Kathy Jo, Tolland, CT, 4/23/09
salt – Laurie, Ft. Myers, FL, 33907
sail – Anjali, Ft. Myers, FL, 4/23/09
mail – Nancy, Ft. Myers, FL, 4/23/09
lame – ken, Bellevue Ia, 4/24/09
meat – Terry, Dubuque, IA, 4/24/09
acme – Bernice, Silver Creek, WA, 4/29/09
cane – Jan, Asotin WA, 4/29/09
pane – Jennifer Asotin WA, 4/29/09
near – John, El Cajon, CA, 4/30/09
dear – Mary, El Cajon, CA, 5/1/09
fear – Pat, Plymouth, MA, 5/2/2009
sear – Carolyn, Turners Falls, MA, 5/2/2009
bear – Judy, W. Splfd, MA, 5/2/09
dear – Marilyn, Rochester, NY, 5/2/09
dean – Dottie, Myrtle Beach, SC, 5/2/2009
lean – Jim, Conway, SC, 5/03/09
jean – pms, 01077, 5/4/09
bean – gail, 06498, 5/03/09
able – Ann, NY, 5/03/09
blab – Bill, NJ, 5/03/09
blob – Nancy, NC, 5/08/09
boob – Bill, Maine, 5/08/09
oboe – Judy, Brevard, NC 5/9/09
boot – Kae, Brevard, NC 5/9/09
toot – Donna, Berea, KY, 5/9/09
tool – Frances, OH, 5/10/09
cool – Barbara, OH, 5/11/09
pool – Carolyn SC, 5/11/09
pole – Brenda, SC, 5/12/09
pile – Marion, SC, 5/13/09
vile – Fran, Texas, 5/13/09
bile – Floyd, SC, 5/14/09
file – Carolyn, SC, 5/1409
fail – Joan, SC, 5/14/09
tail – Larry, St.Pete, Florida, 5/14/09
sail – Mary, Waterloo, NY, 5/15/09
bail – Carol, Clay, NY, 5/16/09
jail – Marie, Hastings, NY, 5/16/09
hail – Tamsie Central Square, NY, 5/17/09
mail – Tree, Constantia, NY, 5/17/09
sail – Holly Hockley, TX, 5/17/09
said – Kathryn Houston, TX, 5/17/09
paid – Karen Gold Run, CA, 05/18/09
laid – Diane, Colfax, CA, 8:07 5/18/09
aida – Mary Jo HVL, Ca, 5/18/09
data – Suzanne, Kaneohe, HI, 5/18/09
dada – Steve, Lincoln, NE, 5/18/2009
nada – Matt, Lincoln, NE, 5/18/2009
effective date: 2009-10-21 14:56:47 UTC