Given three strings(without spaces). The task is to print the new string after modifying the three given string as follows:
- Replace all the vowels present in the first string with “*”.
- Don’t change anything in the second string.
- Replace all the consonants in the third string with “$”.
- Concatenate all of the three string to obtain the new string.
Input : how are you Output : h*ware$ou Input : geeks for geeks Output : g**ksfor$ee$$
The idea is to traverse the first string and keep checking if any character is vowel or not. Replace the character in the first string which is vowel with “*”. Similarly, traverse the third string and keep checking if any character is not a vowel. If a character in the third string is not a vowel(then it is a consonant), replace it with ‘$’.
Finally, concatenate the three strings and print the newly concatenated string.
- Check whether the number formed by concatenating two numbers is a perfect square or not
- Print the first and last character of each word in a String
- Program to print all substrings of a given string
- Print last character of each word in a string
- Print a String in wave pattern
- Print all the combinations of a string in lexicographical order
- Python program to print even length words in a string
- Create a new string by alternately combining the characters of two halves of the string in reverse
- Minimal moves to form a string by adding characters or appending string itself
- std::string::append vs std::string::push_back() vs Operator += in C++
- Find if a string starts and ends with another given string
- String containing first letter of every word in a given string with spaces
- Python | Check if a given string is binary string or not
- Reorder the given string to form a K-concatenated string
- std::string::replace_copy(), std::string::replace_copy_if in C++
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.