#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int count = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'V' && s[i + 1] == 'K') {
      s[i] = '*';
      s[i + 1] = '*';
      i++;
      count++;
    }
  }
  int c = 0;
  for (int i = 0; i < s.length(); i++) {
    if ((s[i] == 'V' && s[i + 1] == 'V') || (s[i] == 'K' && s[i + 1] == 'K')) {
      c++;
      break;
    }
  }
  cout << count + c;
  return 0;
}
