商丘网站制作软件,新闻最新消息今天,十八个免费的舆情网站,空间站做网站什么版本809. 情感丰富的文字——阅读理解题
1、s “abcd”; words [“abc”]; 的情况怎么处理 2、怎么求lens与lenw#xff1f;#xff08;连续出现的字符串长度#xff09;
class Solution {
public:
bool isStretchy(const string s, const string word) {int i 0…809. 情感丰富的文字——阅读理解题
1、s “abcd”; words [“abc”]; 的情况怎么处理 2、怎么求lens与lenw连续出现的字符串长度
class Solution {
public:
bool isStretchy(const string s, const string word) {int i 0;int j 0;while (i s.size() j word.size()) {if (s[i] ! word[j]) {return false;}int lens 0;int lenw 0;while (i lens s.size() s[i lens] s[i]) {lens;}while (j lenw word.size() word[j lenw] word[j]) {lenw;}if ((lens 3 lens ! lenw) || (lenw 0 lens ! 0) || (lens lenw)) {return false;}i lens;j lenw;}return i s.size() j word.size();
}int expressiveWords(string s, vectorstring words) {int count 0;for (int i 0; i words.size(); i) {if (isStretchy(s, words[i])) {count;}}return count;}
};