#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ok2 = 0, ans = 0;
  int ok[100000] = {0};
  for (int i = 0; i < s.length(); i++) {
    if (i < s.length() - 1 && s[i] == 'V' && s[i + 1] == 'K') {
      ok[i] = 1;
      ok[i + 1] = 1;
      ans++;
      i += 1;
    } else {
      if (i > 0 && ok[i] == 0 && ok[i - 1] == 0) {
        if (s[i] == 'K' || s[i - 1] == 'V') ok2 = 1;
      }
    }
  }
  cout << ans + ok2;
}
