#include <bits/stdc++.h>
using namespace std;
const long long int MX = 100005;
long long int ar[MX], br[MX];
string s;
int main() {
  long long int n, m, t, a, b, c, x, y, sum = 0, cnt = 0, i, j, k;
  cin >> s;
  n = s.size();
  for (i = 1; i <= n - 1; i++) {
    if (s[i - 1] == 'V' && s[i] == 'K') {
      cnt++;
      s[i] = '.';
      s[i - 1] = '.';
      i++;
    }
  }
  for (i = 0; i < n - 1; i++) {
    if (s[i] == 'K' && s[i + 1] == 'K') {
      s[i + 1] = 'V';
      cnt++;
      break;
    }
    if (s[i] == 'V' && s[i + 1] == 'V') {
      s[i + 1] = 'K';
      cnt++;
      break;
    }
  }
  cout << (cnt) << endl;
  return 0;
}
