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. MyBatsi学习

    深入浅出Mybatis系列(一)---Mybatis入门 深入浅出Mybatis系列(二)---配置简介(mybatis源码篇) 深入浅出Mybatis系列(三)---配置详解之properties与 ...

  2. wsgiref 与 Django框架初识

    前戏: Web框架的本质 我们可以这样理解:所有的Web应用本质上就是一个socket服务端,而用户的浏览器就是一个socket客户端,这样我们就可以自己实现Web框架 软件开发架构: c/s架构 客 ...

  3. git的优点跟缺点?

    优点: 1.分布式开发时,可以git clone克隆一个本地版本,然后在本地进行操作提交,本地可以完成一个完整的版本控制.在发布的时 候,使用git push来推送到远程即可. 2.git分支的本质是 ...

  4. PHP 函数运行的内存

    函数在运行期间占用的内存,在运行结束后会被回收.但是还有问题不明白,函数内部的echo在函数执行结束后还占用内存吗??? //PHP 函数执行完内存就会被收回 function test() { ec ...

  5. RSA公钥私钥原理及作用

    RSA算法广泛应用与加密与认证两个领域 1.加密(保证数据安全性) 使用公钥加密,需使用私钥解密. 这种广泛应用在保证数据的安全性的方面,用户将自己的公钥广播出去,所有人给该用户发数据时使用该公钥加密 ...

  6. GridView修改含有DropDownList控件列的宽度

    GridView进入Edit模式,编辑列动态绑定DropDown List方便客户选择,但当里面的Item过长,不免令界面不美观 正确做法: <asp:TemplateField HeaderT ...

  7. 如何在一个function里面设置一个全局的变量?

    答:解决方法是在function的开始插入一个global声明: def f() global x

  8. iOS开发~防止navigation多次push一个页面

    在点击push下一个页面时,因为各种原因,点一下cell或按钮没有响应,用户可能就多点几下,这时候会打开好几个一样的页面. 这是因为push后的页面有耗时操作或者刚好push到另一个页面时,另一个页面 ...

  9. REST架构原则初探

    目录 什么是RESTful架构? REST 架构原则 资源(Resource) 表现层(Representation) 状态转换(State Transfer) 无状态通信原则 RESUful API ...

  10. Thingsboard学习之二安装Docker和Docker-Compose

    安装系统更新系统,参考<Thingsboard学习之一CentOS安装系统更新> 尝试更新系统 yum update 增加一个用户并设置密码,并将用户增加到管理员 # 添加用户(可选) s ...