Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
C++ code to find corrected text after double vowel removal
Suppose we have a string S with n character. On a text editor, there is a strange rule. The word corrector of this text editor works in such a way that as long as there are two consecutive vowels in the word, it deletes the first vowel in a word. If there are no two consecutive vowels in the word, it is considered to be correct. We have to find corrected word from S. Here vowels are 'a', 'e', 'i' 'o', 'u' and 'y'.
So, if the input is like S = "poor", then the output will be "por".
Steps
To solve this, we will follow these steps −
n := size of S t := "aeiouy" for initialize i := 1, when iExample
Let us see the following implementation to get better understanding −
#includeusing namespace std; string solve(string S){ int n = S.size(); string t = "aeiouy"; for (int i = 1; i Input
"poor"Output
por
Advertisements
