【Leetcode_easy】824. Goat Latin
problem
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的更多相关文章
- 【LeetCode】824. Goat Latin 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...
- 824. Goat Latin - LeetCode
Questioin 824. Goat Latin Solution 题目大意:根据要求翻译句子 思路:转换成单词数组,遍历数组,根据要求转换单词 Java实现: 用Java8的流实现,效率太低 pu ...
- LeetCode 824 Goat Latin 解题报告
题目要求 A sentence S is given, composed of words separated by spaces. Each word consists of lowercase a ...
- [LeetCode&Python] Problem 824. Goat Latin
A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and up ...
- 824. Goat Latin山羊拉丁文
[抄题]: A sentence S is given, composed of words separated by spaces. Each word consists of lowercase ...
- [LeetCode] 824. Goat Latin
Description A sentence S is given, composed of words separated by spaces. Each word consists of lowe ...
- 824. Goat Latin
class Solution { public: string toGoatLatin(string S) { S.push_back(' '); //add a space that the loo ...
- LeetCode 824. Goat Latin (山羊拉丁文)
题目标签:String 首先把vowel letters 保存入 HashSet. 然后把S 拆分成 各个 word,遍历每一个 word: 当 word 第一个 字母不是 vowel 的时候,把第一 ...
- 【Leetcode_easy】1021. Remove Outermost Parentheses
problem 1021. Remove Outermost Parentheses 参考 1. Leetcode_easy_1021. Remove Outermost Parentheses; 完
随机推荐
- SSL 部署,实现 https 化
HTTPS 请求更安全, 且容易被搜索引擎收录. 现在很多服务器都有免费证书如腾讯云.七牛云.阿里云. 本篇以阿里云为例. 一.申请 SSL 证书 1.登录阿里云服务器: 2.产品与服务 -> ...
- redis 发展史 应用场景
引言 在Web应用发展的初期,那时关系型数据库受到了较为广泛的关注和应用, 原因是因为那时候Web站点基本上访问和并发不高.交互也较少. 而在后来,随着访问量的提升,使用关系型数据库的Web站点多多少 ...
- 作业调度系统PBS(Torque)的设置
1.修改/var/spool/torque/server_priv/目录下的nodes文件 Node1 np=16 gpus=4 Node2 np=16 gpus=4 ... 其中Node1为计算节点 ...
- Oracle 中MERGE语句的用法
原文章出处(http://blog.csdn.net/lichkui/article/details/4306299) MERGE语句是Oracle9i新增的语法,用来合并UPDATE和INSERT语 ...
- 【HDU4622】Reincarnation
[HDU4622]Reincarnation 一眼似乎不可做,但发现\(strlen(x)\)很小,暴力\(O(n^2)\)预处理每个区间\((l,r)\),查询时\(O(1)\)输出就好了 #inc ...
- ZR#999
ZR#999 解法: 一道计数题,看到要求必须 $ m $ 个标号,所有标号至少出现一次的方案. 很容易想到可以容斥,但容斥这个东西是一种很神奇的东西,你可以看出来一道题需要容斥,但你就是不知道怎么容 ...
- tez 0.9.0 配置
官网: https://tez.apache.org/releases/0.9.0/tez-api-javadocs/configs/TezConfiguration.html
- Tkinter 之Label标签
一.参数说明 语法 作用 Label(window,text=‘xxxxx’) 需要在界面显示的Label标签内容 Label(window,text=‘xxxxx’,height=2) 组件的高度( ...
- elasticsearch bootstrap.memory_lock
检查bootstrap.memory_lock设置是否生效 get http://10.127.0.1:9200/_nodes?filter_path=**.mlockall 响应: { " ...
- 按比例吃CPU
前几天测试软件在多核上的性能,需要按照比例吃各个CPU,查了查资料,撸了下面一小段代码: #include <unistd.h> #include <stdlib.h> #in ...