给定字符串作为输入,使用以下算法输出字符串:
1. Split the String by " " (find the words): "Hello World" -> ["Hello","World"]
2. Find the vowel count of each component: [2,1] ( ["H[e]ll[o]","W[o]rld"] )
3. For each of the components, output the first n letter where n is the number
of vowels it contains: ["He","W"]
4. Join the list to a single string and reverse it: "HeW" -> "WeH"
眼镜
您可以采用任何标准格式进行输入并提供输出,并且输入和输出所允许的唯一数据类型是您语言的本机String类型。不允许直接将输入作为单个单词的列表。
您保证不会有连续的空格。
元音是
"a","e","i","o","u","A","E","I","O","U"
但"y","Y"
不被认为是元音。您可以确保在输入中仅出现字母和空格,但没有任何换行符。
输出必须区分大小写。
您不能保证每个单词都包含一个元音。如果该单词中没有元音,则无需输出任何内容。
测试用例
Input -> Output
---------------
"" -> ""
"Hello World" -> "WeH"
"Waves" -> "aW"
"Programming Puzzles and Code Golf" -> "GoCauPorP"
"Yay Got it" -> "iGY"
"Thx for the feedback" -> "eeftf"
"Go Cat Print Pad" -> "PPCG"
"ICE CREAM" -> "RCCI"
计分
每种语言的最短有效提交数将获胜,这是code-golf。祝好运并玩得开心点!
可以看到已删除帖子的人的沙盒。