Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
6288 郑元泰 如何得到"hello" C++ Accepted 0 MS 260 KB 499 2025-01-16 15:41:49

Tests(20/20):


Code:

# include<iostream> # include<cstring> using namespace std; int main(){ char s[1505],a[10]="hello";//指针j // j=0,j=1,j=2 cin>>s; //遍历小明输入的字符s //int n=strlen(s); int p=0; for(int i=0;s[i]!='\0';i++){ if(s[i] == a[p]) p++; if(p==5) { cout<<"YES"; return 0; } } cout<<"NO"; return 0; } //如果可以变成“hello”, 输出“YES”, 否则输出“NO”