Monday, May 30, 2016

CODEFORCES problem 58/A Chat room

Problem link (Click here)

#include <iostream>
#include <cstdio>
#include<cstdlib>
#include <string>

using namespace std;

int main()
{
    string word="hello";
    string type;
    cin>>type;
    int length=type.length();
    int a=0;
    int i, count = 0;
    for(i=0; i<length; i++){
        if(type[i]==word[a]){
            a++;
            count++;
        }
    }
    if(count==5)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}

4 comments:

  1. Replies
    1. Hmm bro. Yeakub Ali Chowdhury Biddapith, SSC 2011 batch..

      Delete
  2. It's not my very first time to visit this blog; I’m visiting this daily and acquire superb info from here day by day. chat gay

    ReplyDelete
  3. #include
    #include
    int main()
    {

    int i,j=0,k,pass=0;
    char ch[100],b[]="hello";
    gets(ch);
    k=strlen(ch);
    for(i=0;i<k;i++){
    if(ch[i]==b[j] ){
    j++;
    pass++;
    }
    }
    if(pass==5){
    printf("YES");
    }
    else {
    printf("NO");
    }



    return 0;
    }

    ReplyDelete