#include <bits/stdc++.h>
using namespace std;
bool visited[10000];
int main() {
  ios::sync_with_stdio(false);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  string input;
  int counter;
  while (cin >> input) {
    counter = 0;
    for (int i = 0; i < input.size() - 1; i++)
      if (input[i] == 'V' && input[i + 1] == 'K')
        counter++, visited[i] = visited[i + 1] = 1, i++;
    for (int i = 0; i < input.size() - 1; i++)
      if (!visited[i] && !visited[i + 1])
        if ((input[i] == 'V' && input[i + 1] == 'V') ||
            ((input[i] == 'K' && input[i + 1] == 'K'))) {
          counter++;
          break;
        }
  }
  cout << counter << endl;
  return 0;
}
