CamelCase is the sequence of one or more than one words 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 a CamelCase sequence represented as a string. The task is to find the number of words in the CamelCase sequence.
Input : str = "geeksForGeeks" Output : 3 Input : str = "iGotAnInternInGeeksForGeeks" Output : 8
Approach: As it is already known that the sequence is CamelCase, so it can be said that the number of words in the sequence will be one more than the number of uppercase letters.
- Iterate the sequence from the 2nd letter to the end of the sequence.
- No. of words will be equal to uppercase letters+1 during the 1st step iteration.
Below is the implementation of the above approach:
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Print all words matching a pattern in CamelCase Notation Dictonary
- Given a sequence of words, print all anagrams together | Set 1
- Given a sequence of words, print all anagrams together using STL
- Given a sequence of words, print all anagrams together | Set 2
- CamelCase Pattern Matching
- Check if the given string of words can be formed from words present in the dictionary
- Reverse String according to the number of words
- Count words that appear exactly two times in an array of words
- Print number of words, vowels and frequency of each character
- Count the number of words having sum of ASCII values less than and greater than k
- Sort an Array alphabetically when each number is converted into words
- Form minimum number from given sequence
- Find if the given number is present in the infinite sequence or not
- Total number of odd length palindrome sub-sequence around each centre
- Find a sequence of N prime numbers whose sum is a composite number
- Convert an unbalanced bracket sequence to a balanced sequence
- Minimum number of operations to convert a given sequence into a Geometric Progression
- Number of closing brackets needed to complete a regular bracket sequence
- Number of ways to divide string in sub-strings such to make them in lexicographically increasing sequence
- Find the number of players who roll the dice when the dice output sequence is given
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.