{"id":"5ed066e5-7ddb-46ea-9674-744e76ba0280","name":"Reverse Vowels Of A String","description":"1. Given a string 's'.\r\n2. Reverse only all the vowels in the string and return it.\r\n3. The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both cases.\r\n","inputFormat":"s = \"hello\"\r\ns = \"PepCoding\"\r\n","outputFormat":"res = \"holle\"\r\nres = \"PipCodeng\"\r\n","constraints":"1. 1 &lt;= s.length() &lt;= 10^5\r\n2. String consist of printable ASCII characters.\r\n","sampleCode":{"cpp":{"code":"#include<bits/stdc++.h>\nusing namespace std;\n\nstring reverseVowels(string &s)\n{\n //write your code here\n}\n\nint main()\n{\n string str;\n cin>>str;\n \n string res = reverseVowels(str);\n cout<<res;\n \n}"},"java":{"code":"import java.util.*;\r\n\r\npublic class Main {\r\n // ~~~~~~~~~~~~~~User Section~~~~~~~~~~~~\r\n public static String reverseVowels(String s) {\r\n // write your code here\r\n }\r\n\r\n // ~~~~~~~~~~~~Input Management~~~~~~~~~~\r\n public static void main(String[] args) {\r\n Scanner scn = new Scanner(System.in);\r\n String str = scn.nextLine();\r\n\r\n String res = reverseVowels(str);\r\n System.out.println(res);\r\n }\r\n}\r\n"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"hello","sampleOutput":"holle\r\n","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"35f2cfb0-6f25-4967-b0c9-92f2384b9260","name":"Arrays And Strings For Intermediate","slug":"arrays-and-strings-for-intermediate-732","type":0},{"id":"a783a21b-517a-4b6e-9899-071fd155c277","name":"Reverse Vowels Of A String","slug":"reverse-vowels-of-a-string","type":1}],"next":{"id":"cf366cb9-2f34-4d4c-8873-58c9b472a637","name":"Reverse Vowels Of A String","type":3,"slug":"reverse-vowels-of-a-string"},"prev":{"id":"7aee95cb-3f94-4a5a-8d95-83932eb54f45","name":"Rotate Image MCQ","type":0,"slug":"rotate-image-mcq"}}}

Reverse Vowels Of A String

1. Given a string 's'. 2. Reverse only all the vowels in the string and return it. 3. The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both cases.

{"id":"5ed066e5-7ddb-46ea-9674-744e76ba0280","name":"Reverse Vowels Of A String","description":"1. Given a string 's'.\r\n2. Reverse only all the vowels in the string and return it.\r\n3. The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both cases.\r\n","inputFormat":"s = \"hello\"\r\ns = \"PepCoding\"\r\n","outputFormat":"res = \"holle\"\r\nres = \"PipCodeng\"\r\n","constraints":"1. 1 &lt;= s.length() &lt;= 10^5\r\n2. String consist of printable ASCII characters.\r\n","sampleCode":{"cpp":{"code":"#include<bits/stdc++.h>\nusing namespace std;\n\nstring reverseVowels(string &s)\n{\n //write your code here\n}\n\nint main()\n{\n string str;\n cin>>str;\n \n string res = reverseVowels(str);\n cout<<res;\n \n}"},"java":{"code":"import java.util.*;\r\n\r\npublic class Main {\r\n // ~~~~~~~~~~~~~~User Section~~~~~~~~~~~~\r\n public static String reverseVowels(String s) {\r\n // write your code here\r\n }\r\n\r\n // ~~~~~~~~~~~~Input Management~~~~~~~~~~\r\n public static void main(String[] args) {\r\n Scanner scn = new Scanner(System.in);\r\n String str = scn.nextLine();\r\n\r\n String res = reverseVowels(str);\r\n System.out.println(res);\r\n }\r\n}\r\n"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"hello","sampleOutput":"holle\r\n","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"35f2cfb0-6f25-4967-b0c9-92f2384b9260","name":"Arrays And Strings For Intermediate","slug":"arrays-and-strings-for-intermediate-732","type":0},{"id":"a783a21b-517a-4b6e-9899-071fd155c277","name":"Reverse Vowels Of A String","slug":"reverse-vowels-of-a-string","type":1}],"next":{"id":"cf366cb9-2f34-4d4c-8873-58c9b472a637","name":"Reverse Vowels Of A String","type":3,"slug":"reverse-vowels-of-a-string"},"prev":{"id":"7aee95cb-3f94-4a5a-8d95-83932eb54f45","name":"Rotate Image MCQ","type":0,"slug":"rotate-image-mcq"}}}
plane

Editor


Loading...

Reverse Vowels Of A String

easy

1. Given a string 's'. 2. Reverse only all the vowels in the string and return it. 3. The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both cases.

Constraints

1. 1 <= s.length() <= 10^5 2. String consist of printable ASCII characters.

Format

Input

s = "hello" s = "PepCoding"

Output

res = "holle" res = "PipCodeng"

Example

Sample Input

hello

Sample Output

holle

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode