917. Reverse Only Letters
❀ Origin
Problem
Given a string S,
return the “reversed” string where all characters that are not a letter stay in the same place,
and all letters reverse their positions.
Note
S.length <= 10033 <= S[i].ASCIIcode <= 122Sdoesn’t contain\or"
Example 1
1  | Input: "ab-cd"  | 
Example 2
1  | Input: "a-bC-dEf-ghIj"  | 
Example 3
1  | Input: "Test1ng-Leet=code-Q!"  | 
❀ 翻譯
問題
給定一個字串 S,回傳反轉過的字串,
其中所有不是字母的字符留在原位,
而所有字母反轉他們的位置。
注意
S.length <= 10033 <= S[i].ASCIIcode <= 122S不會包含\或"
❀ Solution
Golang
1  | /**  |