#include <bits/stdc++.h>
int main() {
  char s[100];
  int i = 0, j = 0, k, count = 0, z = 0, c = 0;
  for (k = 0; k < 100; k++) {
    scanf("%c", &s[k]);
    if (s[k] == '\n') {
      break;
    }
    c++;
  }
  while ((s[i] != '\n') && (c > 1)) {
    if ((s[i] == 'V') && (s[i + 1] == 'K')) {
      count++;
      i = i + 2;
    } else if ((s[i] == 'V') && (s[i + 1] == 'V')) {
      if (z == 0 && (s[i + 2] != 'K')) {
        count++;
        i = i + 2;
        z = 1;
      } else {
        i++;
      }
    } else if ((s[i] == 'K') && (s[i + 1] == 'K')) {
      if (z == 0) {
        count++;
        z = 1;
        i = i + 2;
      } else {
        i++;
      }
    } else if (s[i] == 'K') {
      i++;
    } else {
      break;
    }
  }
  if (c <= 1) {
    printf("0");
  } else {
    printf("%d", count);
  }
  return 0;
}
