Guest User

Untitled

a guest
May 31st, 2010
170
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. f = lambda { |arg|
  2.   begin
  3.     u = arg.class == Fixnum ? "#{arg}|1" : arg
  4.     n = u.split('|')[0].to_i
  5.     raise u.length % 2 == 0 ? u.split('|')[1].split('-').reverse.join('-') : u.split('|')[1] # швыряемся результатом для остроты
  6.   rescue Exception => puts
  7.     puts puts #выводим вывод
  8.   ensure
  9.     u = "#{u}-#{u.split('-').length+1}"
  10.     u.split('-').length < n ? f.call(u) : return
  11.   end
  12. }
  13.  
  14. f.call(10) #сколько хотим
RAW Paste Data