Codeforces Beta Round #54 (Div. 2)
はい。
http://codeforces.com/contest/58
A. Chat room
greedy,strings
ざっくりと大意
・チャットではhelloと挨拶するのが大事??
・間に余計な文字を沢山挟んでも取り除いた形がhelloになればよし
方針のようなもの
・forで順番にhelloを探す。
#!/usr/bin/env python # -*- coding: UTF-8 -*- import time import sys, io import re, math #start = time.clock() n=raw_input() #chk=re.sub(r'hell+o') cnt=0 for i in n: if cnt==0 and i=='h': cnt+=1 elif cnt==1 and i=='e': cnt+=1 elif cnt>=2 and cnt<=3 and i=='l': cnt+=1 elif cnt==4 and i=='o': cnt+=1 print 'YES' if cnt==5 else 'NO'