https://leetcode.com/problems/expressive-words/description/

class Solution {
public:
int expressiveWords(string S, vector<string>& words) {
int res = ;
for (const auto& w : words) {
if (check(S, w))
res++;
}
return res;
}
bool check(const string& s, const string& w) {
int i = , j = , m = s.length(), n = w.length();
while (i < m && j < n) {
if (s[i] != w[j]) return false;
int ii = , jj = ;
while (++i < m && s[i] == s[i-]) ii++;
while (++j < n && w[j] == w[j-]) jj++;
if (ii < jj || ii < && ii != jj) return false;
}
return i == m && j == n;
}
};

最新文章

  1. [bzoj1269][AHOI2006文本编辑器editor] (splay模版题 or pb_ds [rope]大法)
  2. ZeroMQ接口函数之 :zmq_version – 返回ZMQ链接库的版本
  3. p7-p8面试经验总结--拿到offer
  4. SQL Server优化器特性-隐式谓词
  5. Gershgorin圆盘定理
  6. SELinux的故障排除一例
  7. ###C中的extern-static-const关键词
  8. 我也要这样写define、、
  9. MySQL中横表和竖表相互转换
  10. uploadPreview上传图片前预览图片
  11. PHP use闭包函数
  12. Ubuntu 16.04 标题栏实时显示上下行网速、CPU及内存使用率
  13. How to use jQuery countdown plugin
  14. cocos2d-x-3.1 win32程序-初识源代码(coco2d-x 学习笔记二)
  15. wepy - 与原生有什么不同($pages,$interceptors)
  16. jQuery实现页面关键词高亮
  17. Swift coreAnimation 加计时器写的游戏《飞机大战》
  18. uva-10596-欧拉回路
  19. spring --解析自定义注解SpringAOP(配合@Aspect)
  20. php curl get post 方法的封装

热门文章

  1. 2009年3月新浪PHP面试题及答案(一)
  2. myBatis执行测试批量删除,出现测试类正常显示,但数据库数据没变
  3. 【踩坑】vue 无法让后台保存 session
  4. yum 和 rpm安装mysql彻底删除
  5. ps使用
  6. python 函数学习之sys.argv[1]
  7. python 学习之FAQ:文档内容写入报错
  8. 介绍一款渗透神器——Burp Suite
  9. 利用binlog2sql解析mysqlbinlog row行日志
  10. help.hybris.com和help.sap.com网站的搜索实现