Skip to content

Instantly share code, notes, and snippets.

@dbhalling
Created December 12, 2017 21:32
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 dbhalling/53eb4622de95dbee99aee99d31918b8e to your computer and use it in GitHub Desktop.
Save dbhalling/53eb4622de95dbee99aee99d31918b8e to your computer and use it in GitHub Desktop.
#CamelCase
#CamelCase
s = "saveChangesInTheEditor"
def solution(s)
sa = s.chars
sa.keep_if {|v| v =~ /[ABCDEFGHIJKLMNOPQRSTUWXYZ]/}
count = sa.count + 1
return count
end
puts "The number of words in the string is #{solution(s)}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment