Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
78902 邓嘉懿 如何得到"hello" C++ Compile Error 0 MS 0 KB 434 2024-06-29 12:16:37

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ char a[1501] scanf("%s",s); int len=strlen(s); int h=0,e=0,l=0,o=0; for(int i=0;i<len;i++){ if(s[i]=='h'){ h++; }else if(s[i]=='e'&&h>=1){ e++; }else if(s[i]=='l'&&e>=1){ l++; }else if(s[i]=='o'&&l>=2){ o++; } } if(h>=1&&e>=1&&l>=2&&0>=1){ cout<<"YEA"; }else{ cout<<"NO"; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:5:4: error: expected initializer before 'scanf'
    scanf("%s",s);
    ^
Main.cc:6:19: error: 's' was not declared in this scope
    int len=strlen(s);
                   ^