We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8563aa3 commit 23f54daCopy full SHA for 23f54da
String/problem on string/04 Reverse the vowels.cpp
@@ -0,0 +1,29 @@
1
+#include<bits/stdc++.h>
2
+using namespace std;
3
+bool isVowel(char c)
4
+{
5
+ return (c=='a' || c=='A' || c=='e' ||
6
+ c=='E' || c=='i' || c=='I' ||
7
+ c=='o' || c=='O' || c=='u' ||
8
+ c=='U');
9
+}
10
+string reverseVowel(string str)
11
12
+ int j=0;
13
+ string vowel;
14
+ for (int i=0; str[i]!='\0'; i++)
15
+ if (isVowel(str[i]))
16
+ vowel[j++] = str[i];
17
18
19
+ str[i] = vowel[--j] ;
20
+
21
+ return str;
22
23
+int main()
24
25
+ string str;
26
+ cin>>str;
27
+ cout << reverseVowel(str);
28
+ return 0;
29
0 commit comments