Magnus
의견: 0
1 \(s / 64\) \(MB / 50\) points
Magnus lost a game of chess to Kile so he found comfort in competitive programming. Very soon, he
heard of the iconic COCI competition and decided to try his luck there.
He wrote a mail to Kile: “ Dear Kile, please, prepare me for COCI. Magnus ”.
Kile replied: “ You want \(to\) participate \(in\) COCI? All right, here's your wa\(rm-up\) task. \(A\) series \(of\) four
consecutive letters \(of\) some word that make \(up\) the subword “HONI” (Croatian acronym for COCI) \(is\)
called the HO\(NI-bl\)ock. \(I\) will send you the word \(of\) length N and you will throw out as many letters as
you want (it might \(be\) none \(as\) well) \(so\) that \(in\) the end there are as many HO\(NI-bl\)ocks as possible in
the word. Kile ”.
Magnus was very worried and asked you, COCI competitive scene, for help. Help him determine the
maximum number of HO\(NI-bl\)ocks he can get in the final word.
The first line contains a word of length \(N\) (1 ≤ \(N \le 100\,000\)), consisting of uppercase letters of the
English alphabet.
In the first and only line print out the required number of HO\(NI-bl\)ocks.
MAGNUS
HHHHOOOONNNNIIII
PROHODNIHODNIKoutput
output
0
1
2Explanation of the second sample test:
By throwing out three letters ‘H’, ‘O’, ‘N’ or ‘I’ Magnus can get the word “HONI”, which contains one HONI-block.
평가 및 의견
Magnus
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Magnus