Skip to content

Instantly share code, notes, and snippets.

@chiragmongia
Created March 17, 2013 17:53
Show Gist options
  • Save chiragmongia/5182748 to your computer and use it in GitHub Desktop.
Save chiragmongia/5182748 to your computer and use it in GitHub Desktop.
p "Enter the string"
line = gets.chomp
arr = line.split(//)
lower = 0
upper = 0
num = 0
other = -1
for i in 0..arr.size
case arr[i]
when 'a'..'z'
lower += 1
when 'A'..'Z'
upper += 1
when '0'..'9'
num += 1
else
other += 1
end
end
puts "Lowecase- #{lower} \nUppercase- #{upper} \nDigits- #{num} \nOther- #{other}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment