Given a string in Camel Case format, we need to extract all the words which are present in the string.
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 the rest of the letters are lowercase.
Input: str = “GeeksForGeeks”
Input: str = “AComputerSciencePortalForGeeks”
A simple approach is to traverse the array and extract every word by looking at its first character, as it will always be in upper-case. Store all extracted words in a new array and print them.
Geeks For Geeks
Time Complexity: O(N)
Space Complexity: O(N), as we needed a new array to store output.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Convert camel case string to snake case in Java
- Convert Snake Case string to Camel Case in Java
- Sentence Case of a given Camel cased string
- Program to extract words from a given String
- Camel case of a given sentence
- Print all funny words in a string
- Print words of a string in reverse order
- Sort groups of numbers and characters separately in a String
- Java program to print Even length words in a String
- Python | Toggle characters in words having same case
- Check if the given string of words can be formed from words present in the dictionary
- Extract all integers from string in C++
- Extract all integers from the given string in Java
- Python Regex to extract maximum numeric value from a string
- Extract maximum numeric value from a given string | Set 1 (General approach)
- Extract maximum numeric value from a given string | Set 2 (Regex approach)
- Given a sequence of words, print all anagrams together | Set 2
- Given a sequence of words, print all anagrams together using STL
- Print all the non-repeating words from the two given sentences
- Given a sequence of words, print all anagrams together | Set 1
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.