Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def truncateString(s)
- while (true)
- if s[0].to_i % 3 == 0 then
- s[0] = ""
- elsif s[s.length - 1].to_i % 3 == 0 then
- s[s.length - 1] = ""
- elsif (s[0].to_i + s[s.length - 1].to_i) % 3 == 0 then
- s[0] = ""
- s[s.length - 1] = ""
- else
- return s
- end
- if s == "" then
- return s
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment