We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Strings
  4. CamelCase

CamelCase

Problem
Submissions
Leaderboard
Discussions
Editorial
  1. Prepare
  2. Algorithms
  3. Strings
  4. CamelCase
Exit Full Screen View
  • Problem
  • Submissions
  • Leaderboard
  • Discussions
  • Editorial

There is a sequence of words in CamelCase as a string of letters, , having the following properties:

  • It is a concatenation of one or more words consisting of English letters.
  • All letters in the first word are lowercase.
  • For each of the subsequent words, the first letter is uppercase and rest of the letters are lowercase.

Given , determine the number of words in .

Example

There are words in the string: 'one', 'Two', 'Three'.

Function Description

Complete the camelcase function in the editor below.

camelcase has the following parameter(s):

  • string s: the string to analyze

Returns

  • int: the number of words in

Input Format

A single line containing string .

Constraints

Sample Input

saveChangesInTheEditor

Sample Output

5

Explanation

String contains five words:

  1. save
  2. Changes
  3. In
  4. The
  5. Editor

Need help? Try this problem first to get familiar with HackerRank environment.

  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy