http://codeforces.com/contest/58
A
找子序列
1 #include<bits/stdc++.h> 2 using namespace std; 3 #define lson l,mid,rt<<1 4 #define rson mid+1,r,rt<<1|1 5 #define sqr(x) ((x)*(x)) 6 #define pb push_back 7 #define eb emplace_back 8 #define maxn 1000005 9 #define rep(k,i,j) for(int k=i;k<j;k++) 10 typedef long long ll; 11 typedef unsigned long long ull; 12 13 14 int main(){ 15 #ifndef ONLINE_JUDGE 16 // freopen("input.txt","r",stdin); 17 #endif 18 std::ios::sync_with_stdio(false); 19 string str; 20 string s="hello"; 21 cin>>str; 22 int i=0,j=0; 23 while(i<s.length()&&j<str.length()){ 24 if(s[i]==str[j]){ 25 i++,j++; 26 } 27 else{ 28 j++; 29 } 30 } 31 if(i==s.length()){ 32 cout<<"YES"<<endl; 33 } 34 else cout<<"NO"<<endl; 35 }