#include <bits/stdc++.h>
int main() {
  char str[100001];
  int used[100001] = {0};
  scanf("%s", str);
  int times = 0;
  for (int i = 1; str[i] != 0; i++) {
    if (str[i] == 'K' && str[i - 1] == 'V') {
      times++;
      used[i] = 1;
      used[i - 1] = 1;
    }
  }
  for (int i = 0; str[i] != 0; i++) {
    if (!used[i] && !used[i - 1] && (str[i] == 'K' || str[i - 1] == 'V')) {
      times++;
      break;
    }
  }
  printf("%d\n", times);
  return 0;
}
