LOL |
Time Limit: 1000ms, Special Time Limit:2500ms,Memory Limit:65366KB |
Problem description |
Your friend Andreas has a very good sense of humour. In fact, it is so good that he even enjoys to change words so that they will contain the substring lol. For example,during the 2010 FIFA World Cup in soccer he had much fun changing the word fotball to fotbalol. In order to be more ecient in his word plays, he has asked you to make a computer program that nds the minimum number of changes needed in order to transform a string into a new string containing lol as a substring. There are three legal ways to change a string: delete a character, insert a new character and replace an existing character with a new one. |
Input |
The first line of the input consists of a single number T, the number of test cases. Then follows T lines, containing a string S consisting of lower case letters between a and z only. |
Output |
For each string, output on its own line the minimum number of changes needed in order to obtain a string containing lol as a substring. |
Sample Input |
4 fotball sopp ingenting spillolje |
Sample Output |
1 2 3 0 |
Judge Tips |
0 < T <= 100 0 < |S| <= 50 (That is, the maximal string length is 50.) |
Problem Source |
IDIOPEN 2011
题目思路:只要查找字符子串,再处理就OK的了
program:
#include<iostream>
|
HNOJ LOL
最新推荐文章于 2022-07-08 09:54:12 发布