列表

详情


NC230854. Edward Gaming, the Champion

描述

On November 6, 2021, the Chinese team Edward Gaming (EDG) defeated the South Korea team DWG KIA (DK) to win the 2021 League of Legends World championship in Reykjavík, Iceland, lifting the Summoner's Cup for the first time in their history.

While both teams had looked dominant throughout the competition, DK arguably had the advantage. The team hadn't lost a single game until they reached the semi-finals and was the only team to make it out of the Group Stage without a single defeat. They were clearly the team to beat.

EDG had given them a hit at the very first game of the final. The game started with a well-executed gank in the bot lane by EDG for the first blood. Later, EDG took every single Drake and the Baron, and ultimately destroyed the DK's Nexus after 35 minutes.

But DK wouldn't leave it unanswered. They maintained an advantage throughout the second game. Not even the incredible Baron steal by EDG's legendary jungler, Jiejie, could help the team.

The third game turned out to be a difficult one. EDG seems to have control over more resources during the first 30 minutes. However, DK constantly killed every single dragon, and they finally took down the Nexus with the Hand of Baron.

In the fourth game, EDG had rethought their approach and took higher precedence in the control over dragons. The strategy had immediately taken effect, and they won the game after 33 minutes.

All things came down to the last game of the finals. Initially, DK took up the first dragon without much resistance from EDG. Shortly after, EDG picked first blood as DK took the Herald. Everything was fairly even at that moment. The balance finally started to tip in EDG's favor during a team fight in the mid-lane, with EDG killing DK's midlaner Showmaker before they had a chance to respond. The fight finally ended up with four kills and one death for EDG. They snowballed their advantage and finally secured the trophy.

The triumph of the Worlds 2021 made EDG the first team from LPL to win both the Mid-Season Invitational and the World Championship. You have just written a long string to celebrate this great victory. How many occurrences of "edgnb" as a continuous substring are there in the long string? Please write a program to count the number.

输入描述

The only line contains a nonempty string, which consists of no more than  lowercase Latin letters, 'a' to 'z'.

输出描述

Output a line containing a single integer, indicating the number of occurrences of "edgnb" in the given string.

示例1

输入:

edgnb

输出:

1

原站题解

上次编辑到这里,代码来自缓存 点击恢复默认模板

pypy3 解法, 执行用时: 129ms, 内存消耗: 36712K, 提交时间: 2021-11-21 11:05:15

print(input().count('edgnb'))

Python3 解法, 执行用时: 45ms, 内存消耗: 5128K, 提交时间: 2022-05-09 22:16:11

print(input().count("edgnb"))

上一题