Skip to content

Instantly share code, notes, and snippets.

@agnaite
Last active May 18, 2016 22:54
Show Gist options
  • Save agnaite/6ae18f482af9bf5e93d61f1cb60938a4 to your computer and use it in GitHub Desktop.
Save agnaite/6ae18f482af9bf5e93d61f1cb60938a4 to your computer and use it in GitHub Desktop.
def decode(text)
decoded = ''
text.each_char do |s|
if (s =~ /[0-9]/) == 0
text = text[s.to_i+1..-1]
decoded << text[0]
text = text[1..-1]
end
end
puts "DECODED: "+decoded
end
decode("0h2abe1zy")
decode("3yztl1aa0b4dglja2wxs")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment