Classic
Clean & simple
Crystal
Glassmorphism + Neon
Cyberpunk
Neon glitch art
🚫
违规Action检测
禁止Use右键菜单
⚠️ 此Action已被系统记录
1

Strings of Power  

📝 Solutions 🔵 仅限 C++
Problems Description
<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.&nbsp; </p> <p> <br /> </p> <p> <br /> </p> <p> <br /> </p>
Input格式
<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.&nbsp; </p> </div> </div> </div>
Output格式
<div class="page"> <div class="layoutArea"> <div class="column"> <p> Print exactly one number — the number of powerful substrings of the given string.&nbsp; </p> </div> </div> </div>
Sample
Sample Input 1
heavymetalisheavymetal heavymetalismetal trueheavymetalissotruewellitisalsosoheavythatyoucanalmostfeeltheweightofmetalonyou
Sample Output 1
3 2 3
Submit Code
请先Login后Submit

🤖 AI 解题助手

OpenRouter
就绪
👋 你好!我是 AI 解题助手。
我已阅读了这problems题,可以帮你points析思路、提供Code示例。
🔓 完全Free · 无需消耗 Token