Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
6287 邓小龙 如何得到"hello" C++ Accepted 0 MS 272 KB 428 2025-01-16 15:39:11

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