Given a string, extract the first letter of each word in it. “Words” are defined as contiguous strings of alphabetic characters i.e. any upper or lower case characters a-z or A-Z.
Input : Geeks for geeks Output :Gfg Input : United Kingdom Output : UK
This article is contributed by Gaurav Miglani. 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 write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
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 first letter of each word in a string using regex
- Extracting each word from a String using Regex in Java
- String containing first letter of every word in a given string with spaces
- Count of words whose i-th letter is either (i-1)-th, i-th, or (i+1)-th letter of given word
- Check if a string contains only alphabets in Java using Regex
- Move all occurence of letter 'x' from the string s to the end using Recursion
- First uppercase letter in a string (Iterative and Recursive)
- Program to find all match of a regex in a string
- Program to accept String starting with Capital letter
- Number of positions where a letter can be inserted such that a string becomes palindrome
- Check if the string contains consecutive letters and each letter occurs exactly once
- Get K-th letter of the decoded string formed by repeating substrings
- Extract maximum numeric value from a given string | Set 2 (Regex approach)
- Python Regex to extract maximum numeric value from a string
- Java | Removing whitespaces using Regex
- Regex Boundary Matchers in Java
- Count occurrences of a given character using Regex in Java
- Java | Date format validation using Regex
- Most frequent word in first String which is not present in second String
- Length Of Last Word in a String