Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def stolenLunch(note)
- x = 0
- string = ""
- array_1 = ['a','b','c','d','e','f','g','h','i','j']
- array_2 = [0,1,2,3,4,5,6,7,8,9]
- while (x < note.length)
- string = string + note[x]
- x = x + 1
- end
- x = 0
- while (x < string.length)
- if string[x] >= '0' and string[x] <= '9' then
- string[x] = array_1[string[x].to_i]
- elsif
- string[x] >= 'a' and string[x] <= 'j' then
- index = array_1.index(string[x])
- string[x] = array_2[index].to_s
- end
- x = x + 1
- end
- return string
- end
Advertisement
Add Comment
Please, Sign In to add comment