#include <bits/stdc++.h>
using namespace std;
int main() {
  int cnt = 0;
  string s;
  cin >> s;
  if (s.size() == 1) {
    puts("0");
    return 0;
  }
  for (int i = 0; i < s.size() - 1; ++i) {
    if (s[i] == 'V' && s[i + 1] == 'K') ++cnt;
  }
  for (int i = 1; i < s.size() - 1; ++i) {
    if (s[i] == 'V') {
      if (s[i + 1] == 'V' && s[i - 1] == 'V') {
        cout << cnt + 1 << endl;
        return 0;
      }
    } else {
      if (s[i + 1] == 'K' && s[i - 1] == 'K') {
        cout << cnt + 1 << endl;
        return 0;
      }
    }
  }
  if ((s[0] == 'K' && s[1] == 'K') ||
      (s[s.size() - 1] == 'V' && s[s.size() - 2] == 'V')) {
    cout << cnt + 1 << endl;
    return 0;
  }
  cout << cnt << endl;
  return 0;
}
