why race car should return race car instead of reca car?


  • 0
    X

    Your input "race car"

    Your answer "reca car"

    Expected answer "race car"

    Example 2:
    Given s = "leetcode", return "leotcede".


  • 0
    T

    same question


  • 0
    H

    I got the same question and by looking at others' solutions, I found that I was not understanding "reverse only the vowels of a string" correctly. In "race car", the vowels are "aea", if you reverse it, it is still "aea". Hope this helps.


  • 0
    A

    The question states to reverse vowels of a string, which means the input String should be considered as one long set of characters including spaces too.
    Eg:
    "Loophole in Universe"
    should not be considered as
    "Loophole" "in" "Universe"
    The above example has vowels oooeiUiee hence the reverse of the vowels in the string would be
    "LeephilU in enovorso"

    NOTE: You need to maintain the case (Upper, Lower) of the character as well

    same goes for "Race car", vowels are "aea" and the vowel reversed string is "Race car"


  • 0
    T

    @anujshahx @helenxu Got it! Thanks a lot!


  • 0
    X

    @helenxu @anujshahx thanks for both of you. it's like palindrome.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.