# Vowel-Letter reversal output in a string

Source: Internet
Author: User

The vowel-letter reversal in a string

345. Reverse vowels of a StringQuestionEditorial SolutionMy Submissions
• Total accepted:31038
• Total submissions:86077
• Difficulty:easy

Write a function that takes a string as input and reverse only the vowels of a string.

Example 1:
Given s = "Hello", Return "Holle".

Example 2:
Given s = "Leetcode", Return "Leotcede".//1. E and E exchange; 2. E and O Exchange

Note:
The vowels does not include the letter "Y".

Subscribe to see which companies asked this question

`1 Char* Reversevowels (Char*s) {2     3     intLeft,right;4     Chartmp;5 6     Chara[Ten]={'a','e','I','o','u','A','E','I','O','U'};7     Char*tmp_a;8Tmp_a =A;9     intI=0;Ten      Oneleft =0; Aright = strlen (s)-1; -      -      the     //Both sides move the pointer assignment at the same time -      while(Left <Right ) { -TMP =S[left]; -         //left judgment +          while(I <Ten){ -             if(tmp_a[i++] = =S[left]) { +i =0; A                  Break; at             } -  -         } -          -         if(I! =0){ -left++; ini =0;//back to start position -            Continue; to         } +         //Right judgment . -          while(I <Ten){ the             if(tmp_a[i++] = =S[right]) { *i =0; \$                  Break;Panax Notoginseng             }   -         } the          +         if(I! =0){ Aright--; thei =0;//back to start position +            Continue; -         } \$          \$         //tmp = S[left]; -S[left] =S[right]; -S[right] =tmp; theleft++; -right--;Wuyii =0; the     } -  Wu      returns; -  About}`
View Code

Vowel-Letter reversal output in a string

Related Keywords:

### Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.