其他分享
首页 > 其他分享> > 【Codeforces】58A Chat room

【Codeforces】58A Chat room

作者:互联网

原题链接:

A. Chat room

思维点:

ac代码:

#include<iostream>
#include<string>
using namespace std;
int main() {
	string s;
	cin >> s;
	string t = "hello";//创建比较字符串 
	int count = 0, len = s.length();
	for(int i = 0, j = 0; i < len && j < 5; i++) {
		if(t[j] == s[i]) {
			count++;
			j++;
		}
	}
	if(count == 5) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
}

标签:count,room,int,Codeforces,len,++,Chat,string,cout
来源: https://blog.csdn.net/qq_55475680/article/details/121410042