#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int n = S.size();
  int cnt = 0;
  bool f = false;
  for (int i = 0; i < n - 1; i++) {
    if (S[i] == 'V' && S[i + 1] == 'K') {
      cnt++;
      S[i] = S[i + 1] = 'x';
    }
  }
  for (int i = 0; i < n - 1; i++) {
    if ((S[i] == 'V' && S[i + 1] == 'V') || (S[i] == 'K' && S[i + 1] == 'K'))
      f = true;
  }
  if (f) cnt++;
  cout << cnt << endl;
  return 0;
}
