#include <bits/stdc++.h>
using namespace std;
int n, ans;
bool was[50000];
string second;
int main() {
  cin >> second;
  n = second.length();
  for (int i = 1; i < n; i++) {
    if (second[i] == 'K' && second[i - 1] == 'V') {
      ans++;
      was[i] = true;
      was[i - 1] = true;
    }
  }
  for (int i = 1; i < n; i++)
    if (was[i] == false && was[i - 1] == false &&
        (second[i] == 'K' || second[i - 1] == 'V')) {
      cout << ans + 1 << endl;
      return 0;
    }
  cout << ans << endl;
  return 0;
}
