Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.38 KB | None | 0 0
  1. ct = 2
  2. l_a = ("a".."z").to_a
  3. inp = gets.chomp
  4. r_w_a = []
  5. inp.length.times {
  6.   r_w_a << l_a.shuffle[0]
  7. }
  8. rd_word = r_w_a.join
  9. puts "1 " + rd_word
  10.   pos = 0
  11. while rd_word != inp
  12.   if l_a.shuffle[0] == inp.split[pos]
  13.     a = rd_word.split
  14.     a[pos].replace(inp.split[pos])
  15.     rd_word = a.join
  16.     pos += 1
  17.     puts ct.to_s + ' ' + rd_word
  18.     ct += 1
  19.   else
  20.   end
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement