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 firstname.lastname@example.org. 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.
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- Print first letter of each word in a string using regex
- Count of words whose i-th letter is either (i-1)-th, i-th, or (i+1)-th letter of given word
- Extracting each word from a String using Regex in Java
- String containing first letter of every word in a given string with spaces
- Check if the string contains consecutive letters and each letter occurs exactly once
- Print the first and last character of each word in a String
- Remove the first and last character of each word in a string
- Capitalize the first and last character of each word in a string
- Get K-th letter of the decoded string formed by repeating substrings
- First uppercase letter in a string (Iterative and Recursive)
- Longest Common Prefix using Word by Word Matching
- 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
- Most frequent word in first String which is not present in second String
- C program to Replace a word in a text by another given word
- C program to find and replace a word in a File by another given word
- Find the word from a given sentence having given word as prefix
- Find frequency of each word in a string in Python
- Print last character of each word in a string
- Calculate the frequency of each word in the given string