#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int thec(0);
  for (int i = 1; i != str.length(); i++)
    if (str[i - 1] == 'V' && str[i] == 'K') thec++;
  for (int i = 0; i != str.length(); i++)
    if ((str[i] == 'V' && str[i + 1] == 'V' && str[i + 2] != 'K') ||
        (str[i] == 'K' && str[i + 1] == 'K' && str[i - 1] != 'V')) {
      thec++;
      break;
    }
  cout << thec;
}
