class Solution {
public:
void SplitString(const string& s, vector<string>& v, const string& c)
{
string::size_type pos1, pos2;
pos2 = s.find(c);
pos1 = ;
while (string::npos != pos2)
{
v.push_back(s.substr(pos1, pos2 - pos1)); pos1 = pos2 + c.size();
pos2 = s.find(c, pos1);
}
if (pos1 != s.length())
v.push_back(s.substr(pos1));
}
string toGoatLatin(string S) {
vector<string> V;
SplitString(S, V, " ");
set<char> ST;
ST.insert('a'); ST.insert('e'); ST.insert('i'); ST.insert('o'); ST.insert('u');
ST.insert('A'); ST.insert('E'); ST.insert('I'); ST.insert('O'); ST.insert('U');
string Result = "";
for (int i = ; i < V.size(); i++)
{
string word = V[i];
char begin = word[];
string newword = "";
if (ST.find(begin) != ST.end())//元音
{
newword = word + "ma";
}
else//辅音
{
string a = word.substr();
string b = word.substr(, );
newword = a + b + "ma";
}
for (int j = ; j <= i; j++)
{
newword += "a";
}
Result += newword;
if (i != V.size() - )
{
Result += " ";
}
}
return Result;
}
};

最新文章

  1. Android GZIP压缩IO流,优化APP数据传输(一)
  2. Project Euler欧拉计划
  3. QC学习一:Windows环境中Quality Center 9.0安装详解
  4. MyBatis入门案例 增删改查
  5. [ubuntu]deb软件源
  6. iOS:图片拉伸不变形技巧
  7. 关于IE8不支持document.getElementById().innerHTML的问题
  8. Async 与 Await 关键字研究
  9. ZOJ 3696 Alien&#39;s Organ 概率论 泊松分布
  10. jQuery与js的length属性
  11. CSS3 文字与字体相关样式
  12. table-一列细分为多列(合并单元格)
  13. Jmeter二次开发
  14. 字段like多个条件(or关系)简写
  15. JEECG 新手常见问题大全,入门必读
  16. MikroTik RouterOS 5.x使用HunterTik 2.3.1进行破解
  17. SpringBoot的文件下载
  18. console.dir() 与 console.dirxml() 的使用
  19. Gson全解析(上)-Gson基础
  20. Linux 新手入门常用命令

热门文章

  1. day5-hashlib模块
  2. 33-THREE.JS 圆柱体
  3. LeetCode OJ:Longest Palindromic Substring(最长的回文字串)
  4. react login page demo
  5. New Concept English three (41)
  6. 【linux】打包压缩命令
  7. postgresql recovery.conf改变需要重启吗
  8. linux中的阻塞机制及等待队列
  9. [leetcode]_根据二叉树的先序遍历(后序遍历) + 中序遍历 重建二叉树
  10. 剑指offer-第四章解决面试题的思路(包含min函数的栈)