problem

824. Goat Latin

solution

class Solution {
public:
string toGoatLatin(string S) {
unordered_set<char> vowel{ 'a', 'e', 'i', 'o', 'u',
'A', 'E', 'I', 'O', 'U' };//
istringstream iss(S);//
string res, word;
int cnt = ;
while(iss >> word)
{
res += ' ' + (vowel.count(word[]) ? word : word.substr()+word[]) + "ma" + string(cnt, 'a');//err...
cnt++;
}
return res.substr();//err....
}
};

参考

1. Leetcode_easy_824. Goat Latin;

2. grandyang;

3. discuss;

【Leetcode_easy】824. Goat Latin的更多相关文章

  1. 【LeetCode】824. Goat Latin 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...

  2. 824. Goat Latin - LeetCode

    Questioin 824. Goat Latin Solution 题目大意:根据要求翻译句子 思路:转换成单词数组,遍历数组,根据要求转换单词 Java实现: 用Java8的流实现,效率太低 pu ...

  3. LeetCode 824 Goat Latin 解题报告

    题目要求 A sentence S is given, composed of words separated by spaces. Each word consists of lowercase a ...

  4. [LeetCode&Python] Problem 824. Goat Latin

    A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and up ...

  5. 824. Goat Latin山羊拉丁文

    [抄题]: A sentence S is given, composed of words separated by spaces. Each word consists of lowercase ...

  6. [LeetCode] 824. Goat Latin

    Description A sentence S is given, composed of words separated by spaces. Each word consists of lowe ...

  7. 824. Goat Latin

    class Solution { public: string toGoatLatin(string S) { S.push_back(' '); //add a space that the loo ...

  8. LeetCode 824. Goat Latin (山羊拉丁文)

    题目标签:String 首先把vowel letters 保存入 HashSet. 然后把S 拆分成 各个 word,遍历每一个 word: 当 word 第一个 字母不是 vowel 的时候,把第一 ...

  9. 【Leetcode_easy】1021. Remove Outermost Parentheses

    problem 1021. Remove Outermost Parentheses 参考 1. Leetcode_easy_1021. Remove Outermost Parentheses; 完

随机推荐

  1. machine learning(8) -- classification

    分类预测不能使用linear regression, linear regression算法对于分类预测效果很差,应使用logistic regression算法 Logistic regressti ...

  2. WebStorm 安装

    官方下载地址:https://www.jetbrains.com/webstorm/ 下载 安装 等待.......... 安装完成........................  开始使用(第一次 ...

  3. 2019HDU多校第九场 Rikka with Quicksort —— 数学推导&&分段打表

    题意 设 $$g_m(n)=\begin{cases}& g_m(i) = 0,     \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ...

  4. BZOJ2956: 模积和——整除分块

    题意 求 $\sum_{i=1}^n \sum_{j=1}^m (n \ mod \ i)*(m \ mod \ j)$($i \neq j$),$n,m \leq 10^9$答案对 $1994041 ...

  5. 定时器( setInterval和 setTimeout)

    一.定时器setInterval-------常用的,反复循环的 <input type="button" value="停止" id="btn ...

  6. 1059 Prime Factors(25 分)

    Given any positive integer N, you are supposed to find all of its prime factors, and write them in t ...

  7. 支持utf8的str_split函数

    <?php header("Content-type: text/html; charset=utf-8"); /** * 按字节数对字符串进行分片 * @param $st ...

  8. Scrapy不同的item指定不同的Pipeline

    scrapy不同的item指定不同的Pipeline from items import AspiderItem, BspiderItem, CspiderItem class myspiderPip ...

  9. centos 7 启动docker失败。

    刚安装docker-io,在启动的时候报如下错误: Error starting daemon: SELinux is not supported with the overlay2 graph dr ...

  10. vue的基本用法

    公共样式---pc版的404报错 动态src 这个是vue组件template部分 <div class="not-found"> <img :src=" ...