题目描述
<hr /> <p style="text-align:center;"> <span><span><span><span></span></span></span>题目已更正,可以提交</span> </p> <hr /> <hr /> <p> Volodya likes listening to heavy metal and (occasionally) reading. No wonder </p> <p> Volodya is especially interested in texts concerning his favourite music style. </p> <p> Volodya calls a string powerful if it starts with "heavy" and ends with "metal". Finding all powerful substrings (by substring Volodya means a subsequence of consecutive characters in a string) in a given text makes our hero especially joyful. Recently he felt an enormous fit of energy while reading a certain text. So Volodya decided to count all powerful substrings in this text and brag about it all day long. Help him in this difficult task. Two substrings are considered different if they appear at the different positions in the text. </p> <p> For simplicity, let us assume that Volodya's text can be represented as a single string. </p> <p> <br /> </p> <p> <br /> </p> <p> <br /> </p>
输入格式
<div class="page"> <div class="layoutArea"> <div class="column"> <p> Input contains a single non-empty string consisting of the lowercase Latin alphabet letters. Length of this string will not be greater than 1e6 characters. </p> </div> </div> </div>
输出格式
<div class="page"> <div class="layoutArea"> <div class="column"> <p> Print exactly one number — the number of powerful substrings of the given string. </p> </div> </div> </div>
样例
样例输入 1
heavymetalisheavymetal
heavymetalismetal
trueheavymetalissotruewellitisalsosoheavythatyoucanalmostfeeltheweightofmetalonyou
样例输出 1
3
2
3
提交代码
请先登录后提交
🤖 AI 解题助手
DeepSeek
就绪