Thursday, July 3, 2014

Codeforces Beta Round #54 (Div. 2), problem: (A) Chat room solution

Codeforces Beta Round #54 (Div. 2), problem: (A) Chat room: http://codeforces.com/problemset/problem/58/A

Codeforces Beta Round #54 (Div. 2), problem: (A) Chat room editorial: http://codeforces.com/blog/entry/1771

Codeforces Beta Round #54 (Div. 2), problem: (A) Chat room solution: http://ideone.com/GPHEV1


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main() {
    int i=0, cnt=0;
    char s[105];
    scanf("%s", s);
    for(; i<strlen(s); ++i) if(s[i]=='h') {cnt++, i++; break;}
    for(; i<strlen(s); ++i) if(s[i]=='e') {cnt++, i++; break;}
    for(; i<strlen(s); ++i) if(s[i]=='l') {cnt++, i++; break;}
    for(; i<strlen(s); ++i) if(s[i]=='l') {cnt++, i++; break;}
    for(; i<strlen(s); ++i) if(s[i]=='o') {cnt++, i++; break;}
    if(cnt>=5) printf("YES");
    else printf("NO");
    return 0;
}


No comments:

Post a Comment