#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 1;
map<string, long long> mp, pm;
deque<long long> v, vc, ve;
deque<char> p, pe;
deque<string> ts, ss;
deque<double> sd;
long long a, b, c, d, e, f, cnt, ans, r, n, l;
long double q, t, cnt1;
string g, h, w, o, z, m, s;
char y, u;
bool re, rt;
set<long long> st;
vector<pair<long long, long long> > pr, rp;
double man() {
  if (e == sd.size()) return t;
  if (sd[e] > t) t = sd[e];
  e++;
  man();
}
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(0);
  cin >> g;
  if (g.size() == 1) {
    cout << 0;
    return 0;
  } else if (g.size() == 2 and (g == "VV" or g == "KK")) {
    cout << 1;
    return 0;
  }
  if (g[0] == 'K' and g[1] == 'K') {
    g[0] = 'V';
    for (long long i = 0; i < g.size() - 1; i++) {
      if (g[i] == 'V' and g[i + 1] == 'K') cnt++;
    }
    cout << cnt;
    return 0;
  }
  if (g[g.size() - 1] == 'V' and g[g.size() - 2] == 'V') {
    cnt++;
    for (long long i = 0; i < g.size() - 1; i++) {
      if (g[i] == 'V' and g[i + 1] == 'K') cnt++;
    }
    cout << cnt;
    return 0;
  }
  for (long long i = 0; i < g.size() - 2; i++) {
    if (g[i] == 'V' and g[i + 1] == 'V' and g[i + 2] != 'K')
      g[i + 1] = 'K', ans++;
    if (ans == 1) break;
  }
  if (ans == 1) {
    for (long long i = 0; i < g.size() - 1; i++) {
      if (g[i] == 'V' and g[i + 1] == 'K') cnt++;
    }
    cout << cnt;
  } else {
    for (long long i = 2; i < g.size(); i++) {
      if (g[i] == 'K' and g[i - 1] == 'K' and g[i - 2] != 'V')
        g[i - 1] = 'V', ans++;
      if (ans == 1) break;
    }
    for (long long i = 0; i < g.size() - 1; i++) {
      if (g[i] == 'V' and g[i + 1] == 'K') cnt++;
    }
    cout << cnt;
  }
}
