Given a string str consisting of lowercase characters. The task is to replace the consecutive sequence of consonants with their length.
Input: str = “abcdeiop”
Given string contains 2 consonant sequences “bcd” and “p” with lengths 3 and 1.
Input: str = “abecidofu”
Approach: Make a new string which will be free from consonants. For it, we have to iterate the given string. If we find vowel it will be added to the new string as it is. If we find consonant then we have to find the length of complete consonant sequence and then add its length to the new string.
Below is the implementation of the above approach:
- Alternate vowel and consonant string
- Lexicographically first alternate vowel and consonant string
- Print all Subsequences of String which Start with Vowel and End with Consonant.
- Program to count vowels, consonant, digits and special characters in string.
- Minimum length of the sub-string whose characters can be used to form a palindrome of length K
- Total number of odd length palindrome sub-sequence around each centre
- Replace a character c1 with c2 and c2 with c1 in a string S
- Replace all occurrences of pi with 3.14 in a given string
- Replace two substrings (of a string) with each other
- Replace all occurrences of a string with space
- URLify a given string (Replace spaces is %20)
- Program to replace every space in a string with hyphen
- Replace all consonants with nearest vowels in a string
- Replace all occurrences of string AB with C without using extra space
- Recursive program to replace all occurrences of pi with 3.14 in a given 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 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.