#include <bits/stdc++.h>
int main() {
  char str[110];
  gets(str);
  int length = strlen(str);
  int count = 0;
  for (int i = 1; i < length; i++) {
    if (str[i] == 'K' && str[i - 1] == 'V') {
      count++;
      str[i] = ' ';
      str[i - 1] = ' ';
    }
  }
  for (int i = 1; i < length; i++) {
    if (str[i] != ' ' && str[i - 1] != ' ' && str[i] == str[i - 1]) {
      count++;
      str[i] = ' ';
      str[i - 1] = ' ';
      break;
    }
  }
  printf("%d\n", count);
}
