#include <bits/stdc++.h>
using namespace std;
string s;
int dp[101][26][2];
int solve(int i, int last, bool done) {
  if (i == s.length()) return 0;
  if (dp[i][last][done] != -1) return dp[i][last][done];
  int ans = 0;
  if (done) {
    if (last == 'V' - 'A') {
      ans = (s[i] == 'K') + solve(i + 1, s[i] - 'A', done);
    } else {
      ans = solve(i + 1, s[i] - 'A', done);
    }
  } else {
    if (last == 'V' - 'A') {
      if (s[i] == 'K') {
        ans = max(1 + solve(i + 1, s[i] - 'A', done), solve(i + 1, last, true));
      } else {
        ans = max(1 + solve(i + 1, 'K' - 'A', true),
                  solve(i + 1, s[i] - 'A', done));
      }
    } else {
      if (s[i] == 'K')
        ans =
            max(solve(i + 1, s[i] - 'A', done), solve(i + 1, 'V' - 'A', true));
      else
        ans =
            max(solve(i + 1, s[i] - 'A', done), solve(i + 1, 'K' - 'A', true));
    }
  }
  return dp[i][last][done] = ans;
}
int main() {
  cin >> s;
  memset(dp, -1, sizeof dp);
  cout << max(solve(1, s[0] - 'A', false),
              solve(1, s[0] == 'K' ? 'V' - 'A' : 'K' - 'A', true));
  return 0;
}
