★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
➤微信公衆號:山青詠芝(shanqingyongzhi)
➤博客園地址:山青詠芝(https://www.cnblogs.com/strengthen/)
➤GitHub地址:https://github.com/strengthen/LeetCode
➤原文地址:http://www.javashuo.com/article/p-pouimjcy-kx.html
➤若是連接不是山青詠芝的博客園地址,則多是爬取做者的文章。
➤原文已修改更新!強烈建議點擊原文地址閱讀!支持做者!支持原創!
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★html
Given a string S
, remove the vowels 'a'
, 'e'
, 'i'
, 'o'
, and 'u'
from it, and return the new string. git
Example 1:github
Input: "leetcodeisacommunityforcoders"
Output: "ltcdscmmntyfrcdrs"
Example 2:微信
Input: "aeiou"
Output: ""
Note:app
S
consists of lowercase English letters only.1 <= S.length <= 1000
給你一個字符串 S
,請你刪去其中的全部元音字母( 'a'
,'e'
,'i'
,'o'
,'u'
),並返回這個新字符串。 spa
示例 1:code
輸入:"leetcodeisacommunityforcoders" 輸出:"ltcdscmmntyfrcdrs"
示例 2:htm
輸入:"aeiou" 輸出:""
提示:blog
S
僅由小寫英文字母組成。1 <= S.length <= 1000
8msleetcode
1 class Solution { 2 func removeVowels(_ S: String) -> String { 3 let arrS:[Character] = Array(S) 4 var ret:String = String() 5 for i in 0..<S.count 6 { 7 if arrS[i] == "a" || arrS[i] == "e" || arrS[i] == "i" || arrS[i] == "o" || arrS[i] == "u" 8 { 9 continue 10 } 11 else 12 { 13 ret.append(arrS[i]) 14 } 15 } 16 return ret 17 } 18 }