Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created February 1, 2016 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/3d4b6c939262d3ecbaa5 to your computer and use it in GitHub Desktop.
Save chuck0523/3d4b6c939262d3ecbaa5 to your computer and use it in GitHub Desktop.
str = gets.chomp.split('')
a = str[0]
same = 1
for i in 1..str.size do
if a == str[i]
same += 1
else
print a + same.to_s
a = str[i]
same = 1
end
end
puts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment