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;
}
};

809. Expressive Words的更多相关文章

  1. 【LeetCode】809. Expressive Words 解题报告(Python)

    [LeetCode]809. Expressive Words 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http ...

  2. leetcode笔记(五)809. Expressive Words

    题目描述 Sometimes people repeat letters to represent extra feeling, such as "hello" -> &qu ...

  3. [LC] 809. Expressive Words

    Example: Input: S = "heeellooo" words = ["hello", "hi", "helo&quo ...

  4. leetcode 学习心得 (4)

    645. Set Mismatch The set S originally contains numbers from 1 to n. But unfortunately, due to the d ...

  5. All LeetCode Questions List 题目汇总

    All LeetCode Questions List(Part of Answers, still updating) 题目汇总及部分答案(持续更新中) Leetcode problems clas ...

  6. Windows 10 L2TP 809错误

    今天不知道为什么,一直工作正常的L2TP不能连接了.我用的是Surface Pro 3,Windows 10 专业版,操作系统一直保持自动更新,而且最近也没有安装什么软件.点击连接后,等一段时间就报8 ...

  7. NYOJ题目809摸底

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtEAAAI4CAIAAAAj4CIaAAAgAElEQVR4nO3drXLjTLeG4X0S4TmQYB

  8. 如何使用 Zend Expressive 建立 NASA 图片库?

    在本文中,我们将借助 NASA 天文图库 API,使用 Zend Expressive 建立图片库.最后的结果将显示在 AstroSplash 网站,该网站是为了文本特意搭建的.本文系 OneAPM ...

  9. 轨迹系列——Socket总结及实现基于TCP或UDP的809协议方法

    文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/ 1.背景 在上一篇博客中我详细介绍了809协议的内容.809协议规范了通 ...

随机推荐

  1. SQLServer数据库语句大全汇总

    目录清单CONTEXT LIST1.数据库DataBase 1.1数据库建立/删除create/drop database 1.2数据库备份与恢复backup/restore database2.数据 ...

  2. arcgis js 几种拓扑关系详解

    arcgis js的拓扑关系,在处理复杂逻辑和分析时,可以通过拓扑关系,减小客户端的工作量 拓扑关系: 1.overlaps 重叠 这里的重叠跟平时我们理解的不太一样,这里的重叠,必须是A与B有交集, ...

  3. vue-实现一个购物车结算页面

    这是路由之间的跳转,传递值最好采用传参,而不是用$emit和$on,不起作用 如果实在一个页面中的兄弟组件,可以使用$emit和$on 中间件,eventBus.js 放在components目录下面 ...

  4. 入口类和@SpringBootApplication

    SpringBoot通常有一个名为*Application的入口类,入口类里有一个标准的Java应用的入口方法,main方法,在该方法中使用SpringApplication.run(xxxxxApp ...

  5. Java JDBC链接Oracle数据库

    package com.test.test; import java.io.FileInputStream;import java.io.FileNotFoundException;import ja ...

  6. cms-写帖子内容实现

    写帖子后台: mapper: <?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE mapperP ...

  7. 知名nodeJS框架Express作者宣布弃nodeJS投Go

    知名 nodeJS 框架 Express 的作者 TJ Holowaychuk 在 Twitter 发推并链接了自己的一篇文章,宣布弃 nodeJS 投 Go. 他给出的理由是:Go 语言和 Rust ...

  8. HTTP 请求方法介绍

    浏览器从 web 服务器(或者叫应用服务器)上使用 HTTP 协议下载网站,HTTP 协议是基于一种 请求-响应(request-response)模型的.客户端(你的浏览器)从运行在物理机器上的 w ...

  9. SpringMVC-响应数据和结果视图

    返回值分类 1. 字符串 controller 方法返回字符串可以指定逻辑视图名,通过视图解析器解析为物理视图地址. 2. void 在 controller 方法形参上可以定义 request 和 ...

  10. python_33_文件操作2

    f=open('yesterday',encoding='utf-8') #print(f.readline())#读一行,并且是第一行 #读前5行 for i in range(5):#range( ...