QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#3367. LOL

Statistics

你的朋友 Andreas 有很好的幽默感。事实上,他非常喜欢修改单词,使得它们包含子串 lol。例如,在 2010 年 FIFA 世界杯期间,他把单词 fotball 改成 fotbalol 玩得很开心。为了提高他文字游戏的效率,他请你编写一个计算机程序,计算将一个字符串转换为包含 lol 子串的新字符串所需的最少修改次数。修改字符串有三种合法方式:删除一个字符、插入一个新字符以及将现有字符替换为新字符。

输入格式

输入的第一行包含一个整数 $T$,表示测试用例的数量。接下来有 $T$ 行,每行包含一个仅由小写字母 az 组成的字符串 $S$。

输出格式

对于每个字符串,输出一行,表示为了使字符串包含 lol 子串所需的最少修改次数。

数据范围

  • $0 < T \le 100$
  • $0 < |S| \le 50$(即字符串的最大长度为 50。)

样例

输入格式 1

4
fotball
sopp
ingenting
spillolje

输出格式 1

1
2
3
0

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.