LOL

No attempts yetTime limit1sMemory limit256 MB

Problem

A word made of lowercase English letters is given. You want to edit it so that it contains lol as a contiguous substring.

One operation is one of the following.

  • Insert one lowercase English letter at any position.
  • Replace one existing letter with another lowercase English letter.
  • Delete one existing letter.

For each word, find the minimum number of operations needed.

Input

The first line contains the number of test cases TT (1T1001 \le T \le 100).

Each of the next TT lines contains one word. A word is made of lowercase English letters only and its length is at most 5050.

Output

For each word, print on its own line the minimum number of operations that make lol a substring, in the order the words are given.