#include <bits/stdc++.h>
using namespace std;
long long a[200000], b[200000];
long long n, m, k, d, sum, x, y, z;
string s;
void solve() {
  long long res = 0, s1 = 0, i = 0;
  if (s.length() < 2) {
    cout << 0;
    return;
  }
  while (i <= s.length() - 2) {
    if (s[i] == 'V' && s[i + 1] == 'K') {
      res++;
      i += 2;
    } else if ((s[i] == 'V' && s[i + 1] == 'V') &&
               (i + 1 == n || s[i + 2] != 'K')) {
      s1++;
      i += 2;
    } else if ((s[i] == 'K' && s[i + 1] == 'K') &&
               (i == 0 || s[i - 1] != 'V')) {
      s1++;
      i += 2;
    } else
      i++;
  }
  if (s1 > 0) res++;
  cout << res;
}
void readdata() { cin >> s; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  readdata();
  solve();
  return 0;
}
