Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
7614 邓小龙 如何得到"hello" C++ Accepted 5 MS 260 KB 462 2025-05-10 08:57:30

Tests(20/20):


Code:

#include<iostream> #include<cstring> using namespace std; int main(){ char s[1505],a[10]="hello";//指针p // 012345 cin>>s; //遍历小明输入的字符串s int p=0;//查看找到hello的哪个位置 for(int i=0;s[i]!='\0';i++){ if(s[i] == a[p]) p++; if(p==5) { cout<<"YES"<<endl; return 0; } } if(p<5) cout<<"NO"<<endl; return 0; }