Given the string, the task is to capitalise the first and last character of each word in a string.
Input: Geeks for geeks Output: GeekS FoR GeekS Input: Geeksforgeeks is best Output: GeeksforgeekS IS BesT
- Create a character array of the String
- Run a loop from the first letter to the last letter.
- Check if the character is the starting or end of the word
- Check if the character is a small letter.
- If yes, then Capitalise the character of the string.
Below is the implementation of the above approach.
Geeks for Geeks GeekS FoR GeekS
- Print the first and last character of each word in a String
- Remove the first and last character of each word in a string
- Print last character of each word in a string
- Find a string such that every character is lexicographically greater than its immediate next character
- Replace every character of string by character whose ASCII value is K times more than it
- Check if frequency of character in one string is a factor or multiple of frequency of same character in other string
- Replace every character of a string by a different character
- String containing first letter of every word in a given string with spaces
- Most frequent word in first String which is not present in second String
- Lexicographically smallest string formed by appending a character from the first K characters of a given string
- Find the character in first string that is present at minimum index in second string
- Convert the string into palindrome string by changing only one character.
- Length Of Last Word in a String
- Remove a given word from a String
- Find the first repeated word in a string
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.