#P3741. Maximize VK Occurrences

    ID: 16992 Type: Default 1000ms 256MiB

Maximize VK Occurrences

Maximize VK Occurrences

You are given a string consisting only of the characters V and K. Whenever the substring VK appears (i.e. a character V immediately followed by a K), it increases the attractiveness of the string.

You are allowed to change at most one character (or make no change) to maximize the number of occurrences of VK in the string. Your task is to compute the maximum number of VK substrings that can appear in the string after at most one modification.

\(\textbf{Note}: Only adjacent characters exactly forming the substring \(VK\) are counted.

inputFormat

The input consists of a single string s which only contains the characters V and K.

\(1 \leq |s| \leq 10^5\)

outputFormat

Output a single integer representing the maximum number of occurrences of the substring VK that can be achieved after at most one character change.

sample

VK
1