#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 1; i < s.size(); ++i) {
    if (s[i - 1] == 'V' && s[i] == 'K') {
      s[i - 1] = 'B';
      s[i] = 'B';
      ans++;
    }
  }
  for (int i = 1; i < s.size(); ++i) {
    if (s[i - 1] == 'V' && s[i] != 'B') {
      ans++;
      break;
    }
    if (s[i] == 'K' && s[i - 1] != 'B') {
      ans++;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
