#P7313. [COCI 2018/2019 #3] Magnus
[COCI 2018/2019 #3] Magnus
Description
You are given a word of length . Delete any number of letters from the word so that you can form as many HONI as possible.
Input Format
Input a string of length containing only English letters, representing the given word.
Output Format
Output the maximum number of HONI that can be formed.
MAGNUS
0
HHHHOOOONNNNIIII
1
PROHODNIHODNIK
2
Hint
Explanation of Sample 2
You can delete the earliest occurrences of each of the four letters H, O, N, I from the original word to obtain HONI.
Constraints
For of the testdata, .
Notes
The score of this problem follows the original COCI setting, with a full score of .
Translated from COCI2018-2019 CONTEST #3 T1 Magnus.
Translated by ChatGPT 5
京公网安备 11011102002149号