RoAlgo Educational Round #2 | modificare

This was the problem page during the contest. Access the current page here.
Time limit: 0.1s Memory limit: 4MB Input: Output:

Task

You are given a string ss which contains only small lowercase letters. Find the minimum number of operations required such that ss will have the string roalgo as a substring. The operation we are allowed to use is to replace one of the letters with another.

Input data

The first line will contain the given string ss.

Output data

The first line will contain an integer xx, the number of operations required to get the string roalgo as a substring. If the substring is already present, print 00.

Constraints and clarifications

  • 6s100 0006 \leq |s| \leq 100 \ 000, where s|s| is the length of ss.

Example

stdin

qaorxqlgp

stdout

3

Explanations

The minimal number of operations is 33 (substring rxqlgp can be transformed to roalgo by replacing x, q and p with the suitable letters.

Log in or sign up to be able to send submissions!