Tonio has a keyboard with only two letters, "V" and "K".

One day, he has typed out a string s with only these two letters. He really likes it when the string "VK" appears, so he wishes to change at most one letter in the string (or do no changes) to maximize the number of occurrences of that string. Compute the maximum number of times "VK" can appear as a substring (i. e. a letter "K" right after a letter "V") in the resulting string.


-----Input-----

The first line will contain a string s consisting only of uppercase English letters "V" and "K" with length not less than 1 and not greater than 100.


-----Output-----

Output a single integer, the maximum number of times "VK" can appear as a substring of the given string after changing at most one character.


-----Examples-----
Input
VK

Output
1

Input
VV

Output
1

Input
V

Output
0

Input
VKKKKKKKKKVVVVVVVVVK

Output
3

Input
KVKV

Output
1



-----Note-----

For the first case, we do not change any letters. "VK" appears once, which is the maximum number of times it could appear.

For the second case, we can change the second character from a "V" to a "K". This will give us the string "VK". This has one occurrence of the string "VK" as a substring.

For the fourth case, we can change the fourth character from a "K" to a "V". This will give us the string "VKKVKKKKKKVVVVVVVVVK". This has three occurrences of the string "VK" as a substring. We can check no other moves can give us strictly more occurrences.

Source: codeforces | Difficulty: EASY
Tags: Complete search


Solutions:
s = input()
res = s.count('VK')
s = s.split('VK')
res += sum(['VV' in x or 'KK' in x for x in s]) > 0
print(res)


import sys
s = input()
count = s.count('VK')
i = 0
for i in range(len(s) - 1):
	if s[i] == 'K' and s[i + 1] == 'K':
		if i == 0:
			count += 1
			break
		elif i > 0:
			if s[i - 1] == 'K':
				count += 1
				break
	elif s[i] == 'V' and s[i + 1] == 'V':
		try:
			if s[i + 2] == 'V':
				count += 1
				break
		except IndexError:
			count += 1
			break
print(count)


s = input()
cnt = s.count('VK')
s = s.replace('VK', ' ')
if 'VV' in s or 'KK' in s:
	cnt += 1
print(cnt)


source_text = input()
count = source_text.count('VK')
source_text = source_text.replace('VK', '-')
if 'VV' in source_text or 'KK' in source_text:
	count += 1
print(count)


import sys
string = input()
cnt = v = 0
s = ''
if len(string) == 1:
	print('0')
elif len(string) == 2:
	if 'KV' in string:
		print('0')
	else:
		print('1')
else:
	for i in range(0, len(string) - 1):
		if v == 1:
			v = 0
			continue
		if string[i] == 'V' and string[i + 1] == 'K':
			cnt += 1
			v = 1
			s += '0'
		else:
			s += string[i]
			v = 0
		if i == len(string) - 2:
			s += string[len(string) - 1]
	if 'VV' in s or 'KK' in s:
		cnt += 1
	print(cnt)


s = input()
l = len(s)
numbers = [s.count('VK')]
for x in range(l):
	temp = s[:x]
	a = s[x]
	if a == 'V':
		temp += 'K'
	else:
		temp += 'V'
	temp += s[x + 1:]
	numbers.append(temp.count('VK'))
print(max(numbers))


s = input()
k = s.count('VK')
for i in range(len(s)):
	s1 = s[:i] + 'V' + s[i + 1:]
	p = s1.count('VK')
	k = max(k, p)
	s1 = s[:i] + 'K' + s[i + 1:]
	p = s1.count('VK')
	k = max(k, p)
print(k)


s = list(' ' + input())
m = 0
for i in range(len(s)):
	ss = []
	for i0 in range(len(s)):
		ss.append(s[i0])
	if ss[i] == 'V':
		ss[i] = 'K'
	elif ss[i] == 'K':
		ss[i] = 'V'
	mm = 0
	for i0 in range(len(s) - 1):
		if ss[i0] == 'V' and ss[i0 + 1] == 'K':
			mm = mm + 1
	if mm > m:
		m = mm
print(m)


import sys

def solve():
	s = [ch for ch in input()]
	ans = ''.join(s).count('VK')
	for i in range(len(s)):
		if s[i] == 'V':
			s[i] = 'K'
			tmp = ''.join(s).count('VK')
			ans = max(ans, tmp)
			s[i] = 'V'
		else:
			s[i] = 'V'
			tmp = ''.join(s).count('VK')
			ans = max(ans, tmp)
			s[i] = 'K'
	print(ans)

def debug(x, table):
	for (name, val) in table.items():
		if x is val:
			print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
			return None
solve()


s = input()
ans = 0
for i in range(len(s)):
	for j in ['V', 'K']:
		t = s[:i] + j + s[i + 1:]
		cur = 0
		for k in range(len(s) - 1):
			if t[k] == 'V' and t[k + 1] == 'K':
				cur += 1
		ans = max(ans, cur)
print(ans)


x = input()
count = 0
if len(x) > 1:
	for i in range(len(x) - 1):
		y = x[i:i + 2]
		if y == 'VK':
			count += 1
		if i == len(x) - 2:
			if y == 'VV':
				count += 1
				print(count)
				exit(0)
	y = x[0:2]
	if y == 'KK':
		count += 1
		print(count)
		exit(0)
if len(x) > 2:
	i = 0
	while i < len(x) - 2:
		y = x[i:i + 3]
		if y == 'VVV' or y == 'KKK':
			count += 1
			break
		i += 1
print(count)


s = 'K' + input() + 'V'
print(s.count('VK') + ('VVV' in s or 'KKK' in s))


a = input()
a = a.replace('VK', 'AA')
z = a.count('A') // 2
a = a.replace('VV', 'W')
a = a.replace('KK', 'W')
if 'W' in a:
	z += 1
print(z)


s = input()
print(max(((s[:i] + letter + s[i + 1:]).count('VK') for letter in 'VK' for i in range(len(s)))))


def check(s, length):
	if length == 1:
		print(0)
		exit()
	if length == 2 and s != 'KV':
		print(1)
		exit()
	if length == 2 and s == 'KV':
		print(0)
		exit()
from sys import exit
s = input()
length = len(s)
check(s, length)
vkCount = s.count('VK')
flag = False
if 'VVV' in s or 'KKK' in s or s[-2:] == 'VV' or (s[:2] == 'KK'):
	flag = True
print(vkCount + 1) if flag else print(vkCount)


s = list(input())
ANS = 0
for j in range(len(s) - 1):
	if s[j] + s[j + 1] == 'VK':
		ANS += 1
for i in range(len(s)):
	ans = 0
	if s[i] == 'V':
		s[i] = 'K'
	else:
		s[i] = 'V'
	for j in range(len(s) - 1):
		if s[j] + s[j + 1] == 'VK':
			ans += 1
	if ans > ANS:
		ANS = ans
	if s[i] == 'V':
		s[i] = 'K'
	else:
		s[i] = 'V'
print(ANS)


s = list(input())

def cnt(str):
	rtn = 0
	for i in range(1, len(str)):
		if str[i - 1] == 'V' and str[i] == 'K':
			rtn += 1
	return rtn

def change(str, idx):
	if str[idx] == 'V':
		return str[:idx] + ['K'] + str[idx + 1:]
	else:
		return str[:idx] + ['V'] + str[idx + 1:]
ans = cnt(s)
for i in range(len(s)):
	ans = max(cnt(change(s, i)), ans)
print(ans)


s = input()
ans = s.count('VK')
s = s.replace('VK', '--')
if s.find('VV') > -1 or s.find('KK') > -1:
	ans += 1
print(ans)


s = list(input())
ans = ''.join(s).count('VK')
for i in range(len(s)):
	t = s.copy()
	sus = {'V', 'K'}
	sus.discard(s[i])
	t[i] = sus.pop()
	ans = max(ans, ''.join(t).count('VK'))
print(ans)


s = list(input())
s_v = s[:]
s_k = s[:]
for i in range(len(s) - 1):
	if s[i] == 'K' and s[i + 1] == 'K' and (i == 0 or (i > 0 and s[i - 1] != 'V')):
		s_v[i] = 'V'
		break
for i in range(1, len(s)):
	if s[i] == 'V' and s[i - 1] == 'V' and (i == len(s) - 1 or (i < len(s) - 1 and s[i + 1] != 'K')):
		s_k[i] = 'K'
		break
result = map(lambda x: ''.join(x).count('VK'), [s, s_v, s_k])
print(max(result))


s = input()
m = s.count('VK')
for i in range(len(s)):
	s2 = s[:i] + 'V' + s[i + 1:]
	s3 = s[:i] + 'K' + s[i + 1:]
	m = max(m, s2.count('VK'))
	m = max(m, s3.count('VK'))
print(m)


string = input()
check = False
counter = 0
for i in range(1, len(string)):
	if string[i] == 'K' and (not check):
		if string[i - 1] == 'V':
			check = True
			counter += 1
	if string[i] == 'V':
		check = False
check = False
if len(string) > 1:
	if string[-2:] == 'VV':
		counter += 1
		check = True
	if not check:
		if string[:2] == 'KK':
			counter += 1
			check = True
if not check:
	if 'VVV' in string:
		counter += 1
		check = True
if not check:
	if 'KKK' in string:
		counter += 1
		check = True
print(counter)


f = '  '
f += input()
n = len(f)
k = 0
q = 0
i = 2
f += '  '
while i < n:
	if f[i] + f[i + 1] == 'VK':
		k += 1
		i += 1
	elif f[i] + f[i + 1] == 'VV' and f[i + 2] != 'K':
		q += 1
		i += 1
	elif f[i] + f[i + 1] == 'KK' and f[i - 1] != 'V':
		q += 1
	i += 1
print(k + (q > 0))


a = input()
b = [a.count('VK')] + [0] * len(a)
s = a[:]
for i in range(len(a)):
	if a[i] == 'V':
		if i != len(a) - 1:
			s = s[:i] + 'K' + s[i + 1:]
		else:
			s = s[:i] + 'K'
	elif i != len(a) - 1:
		s = s[:i] + 'V' + s[i + 1:]
	else:
		s = s[:i] + 'V'
	b[i + 1] = s.count('VK')
	s = a[:]
print(max(b))


s = input().lower()
c = s.count('vk')
s1 = s.split('vk')
c += sum(('vv' in i or 'kk' in i for i in s1)) > 0
print(c)


s = str(input())
res = 0
a = [0 for i in range(len(s))]
for i in range(0, len(s)):
	if s[i] == 'V':
		a[i] = 0
	else:
		a[i] = 1
for i in range(0, len(a)):
	a[i] = 1 - a[i]
	cnt = 0
	for j in range(len(a) - 1):
		if a[j] == 0 and a[j + 1] == 1:
			cnt += 1
	if res < cnt:
		res = cnt
	a[i] = 1 - a[i]
	cnt = 0
	for j in range(len(a) - 1):
		if a[j] == 0 and a[j + 1] == 1:
			cnt += 1
	if res < cnt:
		res = cnt
print(res)


s = input()
mx = s.count('VK')
d = {'V': 'K', 'K': 'V'}
for i in range(len(s)):
	mx = max(mx, (s[:i] + d[s[i]] + s[i + 1:]).count('VK'))
print(mx)


s = input()
count = 0
s = s.replace('VK', 'A')
p = s.replace('KK', 'B')
if p == s:
	p = s.replace('VV', 'B')
if p != s:
	count = count + 1
for i in s:
	if i == 'A':
		count = count + 1
print(count)


string = input()
ans = string.count('VK')
string = string.replace('VK', ' ')
ans += 1 if 'VV' in string or 'KK' in string else 0
print(ans)


a = str(input())
q = a.count('VK')
w = a.count('KK') - a.count('VKK') + a.count('VV') - a.count('VVK') + a.count('VVV') + a.count('KKK')
if w > 0:
	print(q + 1)
else:
	print(q)


s = input().strip()
ans = s.count('VK')
for i in s.split('VK'):
	if 'KK' in i or 'VV' in i:
		ans += 1
		break
print(ans)


s = input()
maxx = 0
for i in range(len(s)):
	news = s[:i] + 'V' + s[i + 1:]
	maxx = max(news.count('VK'), maxx)
	news = s[:i] + 'K' + s[i + 1:]
	maxx = max(news.count('VK'), maxx)
print(maxx)


import sys
arr = list(sys.stdin.readline().rstrip())
st = []
ans = 0
idx = 0
while idx < len(arr) - 1:
	if arr[idx] + arr[idx + 1] == 'VK':
		idx += 2
		ans += 1
	else:
		st.append((arr[idx], idx))
		idx += 1
if idx == len(arr) - 1:
	st.append((arr[idx], idx))
can = False
for i in range(len(st) - 1):
	if st[i][0] == st[i + 1][0]:
		if abs(st[i][1] - st[i + 1][1]) == 1:
			can = True
			break
print(ans + 1 if can else ans)


s = input()
n = len(s)

def f(s):
	vk = 0
	for i in range(n):
		if s[i:i + 2] == 'VK':
			vk += 1
	return vk
vk = f(s)
for i in range(n):
	vk = max(vk, f(s[:i] + 'V' + s[i + 1:]))
	vk = max(vk, f(s[:i] + 'K' + s[i + 1:]))
print(vk)


def f(l):
	c = l.count('VK')
	if 'KKK' in l or 'VVV' in l or l[:2] == 'KK' or (l[-2:] == 'VV'):
		c += 1
	return c
print(f(input()))


s = input()
k = 0
for i in range(len(s) - 1):
	if s[i] == 'V' and s[i + 1] == 'K':
		k += 1
for i in range(len(s)):
	if i < len(s) - 1:
		if s[i] == 'V' and s[i + 1] == 'V' and (i + 2 == len(s)):
			k += 1
			break
		if s[i] == 'V' and s[i + 1] == 'V' and (s[i + 2] == 'V'):
			k += 1
			break
	if i >= 1:
		if i == 1 and s[1] == 'K' and (s[0] == 'K'):
			k += 1
			break
		if s[i] == 'K' and s[i - 1] == 'K' and (s[i - 2] == 'K'):
			k += 1
			break
print(k)


s = list(input())
ans = 0
d = 0
ched = 0
for i in range(1, len(s)):
	if s[i] == 'K' and s[i - 1] == 'V':
		d = 1
		ans += 1
	elif ched == 1:
		continue
	elif s[i - 1] == 'V':
		if i == len(s) - 1 or s[i + 1] == 'V':
			ched = 1
			ans += 1
			s[i] = 'K'
		else:
			d = 0
	elif s[i - 1] == 'K':
		if d == 0 and s[i] == 'K':
			ans += 1
			s[i - 1] = 'V'
			ched = 1
		else:
			d = 0
print(ans)


import sys
s = input()
cnt = found = 0
s2 = ''
for i in range(len(s)):
	if found == 1:
		found = 0
		continue
	if i != len(s) - 1 and s[i] == 'V' and (s[i + 1] == 'K'):
		cnt += 1
		found = 1
		s2 += '0'
	else:
		s2 += s[i]
if 'VV' in s2 or 'KK' in s2:
	cnt += 1
print(cnt)


s = input()
if ('VVV' in s or 'KKK' in s or s.find('KK') == 0 or (s.rfind('VV') == len(s) - 2)) and len(s) != 1:
	print(s.count('VK') + 1)
else:
	print(s.count('VK'))


typedString = input()

def replaceCharAt(index, newChar):
	asList = list(typedString)
	asList[index] = newChar
	return ''.join(asList).count('VK')

def findMaxOccurenceFor(newChar):
	maxVK = typedString.count('VK')
	for index in range(len(typedString)):
		maxVK = max(maxVK, replaceCharAt(index, newChar))
	return maxVK
solution = max(findMaxOccurenceFor('V'), findMaxOccurenceFor('K'))
print(solution)


S = input()
N = len(S)
now = 0
for i in range(N - 1):
	if S[i:i + 2] == 'VK':
		now += 1
ans = now
for i in range(N):
	if S[i] == 'V':
		if i >= 1 and S[i - 1] == 'V':
			if i == N - 1 or (i < N - 1 and S[i + 1] == 'V'):
				ans += 1
				print(ans)
				exit()
	elif i < N - 1 and S[i + 1] == 'K':
		if i == 0 or (i > 0 and S[i - 1] != 'V'):
			ans += 1
			print(ans)
			exit()
print(ans)


__author__ = 'zihaozhu'
from sys import stdin
from collections import deque
from collections import defaultdict
import re
import math
st = stdin.readline().rstrip()
if len(st) == 2 and st == 'VK':
	print(1)
elif len(st) < 2:
	print(0)
else:
	arr = []
	newst = ''
	z = 0
	precount = 0
	st = st + 'X'
	while z < len(st) - 1:
		if st[z] == 'V' and st[z + 1] == 'K':
			precount += 1
			z += 2
			if len(newst) != 0:
				arr.append(newst)
				newst = ''
		else:
			newst = newst + st[z]
			z += 1
	if len(newst) != 0:
		arr.append(newst)
		newst = ''
	newst = newst + 'X'
	for news in arr:
		b = 0
		while b < len(news) - 1:
			if news[b] == 'V' and news[b + 1] == 'V':
				precount += 1
				print(precount)
				exit()
			elif news[b] == 'K' and news[b + 1] == 'K':
				precount += 1
				print(precount)
				exit()
			else:
				b += 1
	print(precount)


s = input()
if s == 'VV':
	c = 1
else:
	c = s.count('VK')
	if s.find('VVV') >= 0 or s.find('KKK') >= 0 or s.startswith('KK') or s.endswith('VV'):
		c += 1
print(c)


s = input()
V = 'V'
K = 'K'

def g(s):
	res = 0
	for (i, c) in enumerate(list(s)):
		if i == 0:
			continue
		if s[i] == K and s[i - 1] == V:
			res += 1
	return res

def rev(c):
	if c == V:
		return K
	else:
		return V
res = g(s)
for i in range(len(s)):
	res = max(res, g(s[:i] + rev(s[i]) + s[i + 1:]))
print(res)


s = '-' + input() + '-'
p = 0
sh = 0
for i in range(1, len(s) - 2):
	if s[i] + s[i + 1] == 'VK':
		sh += 1
	if s[i] + s[i + 1] == 'KK' and p == 0:
		if s[i - 1] == '-' or s[i - 1] == 'K':
			sh += 1
			p += 1
	if s[i] + s[i + 1] == 'VV' and p == 0:
		if s[i + 2] == '-' or s[i + 2] == 'V':
			sh += 1
			p += 1
print(sh)


s = list(input())
for i in range(len(s) - 1):
	if s[i] == s[i + 1] == 'V':
		if i == len(s) - 2 or s[i + 2] == 'V':
			s[i + 1] = 'K'
			break
	elif s[i] == s[i + 1] == 'K':
		if i == 0 or s[i - 1] == 'K':
			s[i] = 'V'
			break
print(''.join(s).count('VK'))


s = str(input())
match = []
i = -2
match.append(i)
i = 0
i = s.find('VK', i)
while i != -1:
	match.append(i)
	i = s.find('VK', i + 1)
match.append(len(s))
l = len(match)
g = False
for i in range(l - 1):
	delta = match[i + 1] - match[i]
	if delta > 4:
		print(l - 1)
		g = True
		break
	elif delta == 4 and (not (s[match[i] + 2] == 'K' and s[match[i + 1] - 1] == 'V')):
		print(l - 1)
		g = True
		break
if not g:
	print(l - 2)


def c(S):
	a = 0
	for i in range(len(S) - 1):
		if s[i] == 'V' and s[i + 1] == 'K':
			a += 1
	return a
x = input()
s = [z for z in x]
r = 0
for i in range(len(s)):
	t = s[i]
	if s[i] == 'V':
		s[i] = 'K'
	else:
		s[i] = 'V'
	r = max(r, c(s))
	if s[i] == 'V':
		s[i] = 'K'
	else:
		s[i] = 'V'
	r = max(r, c(s))
print(r)


string = input()
count = string.count('VK')
if 'VV' in string.replace('VK', '-') or 'KK' in string.replace('VK', '-'):
	count += 1
print(count)


def s():
	inp = input()
	cnt = 0
	for i in range(len(inp) - 1):
		if inp[i] == 'V' and inp[i + 1] == 'K':
			cnt += 1
	for i in range(len(inp) - 2):
		if inp[i] == 'V' and inp[i + 1] == 'V' and (inp[i + 2] == 'V'):
			cnt += 1
			return cnt
		if inp[i] == 'K' and inp[i + 1] == 'K' and (inp[i + 2] == 'K'):
			cnt += 1
			return cnt
	if len(inp) >= 2:
		if inp[0] == 'K' and inp[1] == 'K':
			cnt += 1
			return cnt
		if inp[-1] == 'V' and inp[-2] == 'V':
			cnt += 1
			return cnt
	return cnt
print(s())


def cnt(r):
	c = 0
	for i in range(len(r) - 1):
		c += r[i] == 'V' and r[i + 1] == 'K'
	return c
s = list(input())
m = cnt(s)
for i in range(len(s)):
	tmp = s.copy()
	tmp[i] = 'K' if tmp[i] == 'V' else 'V'
	m = max(m, cnt(tmp))
print(m)


s = input()
print(s.count('VK') + min(s.replace('VK', ' ').count('VV') + s.replace('VK', ' ').count('KK'), 1))


import re

def count(s):
	return len(re.findall('VK', s))
s = input().strip()
best = count(s)
for i in range(len(s)):
	cur_s = s[:i] + 'V' + s[i + 1:]
	best = max(best, count(cur_s))
	cur_s = s[:i] + 'K' + s[i + 1:]
	best = max(best, count(cur_s))
print(best)


s = input()
print(max(((s[:i] + c + s[i + 1:]).count('VK') for i in range(len(s)) for c in ['V', 'K'])))


def solve(s):
	if len(s) < 2:
		return 0
	counter = 0
	for (i, c) in enumerate(s):
		if len(s) > i + 1:
			if c == 'V' and s[i + 1] == 'K':
				s[i] = False
				s[i + 1] = False
				counter += 1
	for (i, c) in enumerate(s):
		if len(s) > i + 1:
			if c and c == s[i + 1]:
				counter += 1
				return counter
	return counter
print(solve(list(input())))


s = list(input())
count = 0
changed = False
for i in range(len(s)):
	if len(s) == 1:
		break
	if i < len(s) - 1 and s[i] == 'V' and (s[i + 1] == 'K'):
		count += 1
		continue
	if changed == False:
		if i == 0:
			if s[i] == 'K' and s[i + 1] == 'K':
				s[i] = 'V'
				count += 1
				changed = True
		elif i != len(s) - 1:
			if s[i] == 'K':
				if s[i - 1] != 'V' and s[i + 1] == 'K':
					s[i] = 'V'
					count += 1
					changed = True
					continue
			elif s[i - 1] == 'V' and s[i + 1] != 'K':
				s[i] = 'K'
				count += 1
				changed = True
				continue
		elif s[i] == 'V' and s[i - 1] == 'V':
			s[i] = 'K'
			count += 1
print(count)


line = str(input())
s = len(line)
rest = 0
candi = list()
for i in range(s - 1):
	if line[i:i + 2] == 'VK':
		rest += 1
		candi.append(i)
		candi.append(i + 2)
candi = [0] + candi + [s]
s = len(candi)
flag = False
for i in range(s - 1):
	refer = line[candi[i]:candi[i + 1]]
	if 'VV' in refer or 'KK' in refer:
		flag = True
print(rest + (1 if flag else 0))


def conta(s):
	n = 0
	for i in range(len(s) - 1):
		if s[i:i + 2] == 'VK':
			n += 1
	return n
s = input()
max_times = conta(s)
for j in range(len(s)):
	s1 = s[0:j]
	if s[j] == 'V':
		s2 = 'K'
	else:
		s2 = 'V'
	s3 = s[j + 1:]
	s_mod = s1 + s2 + s3
	if conta(s_mod) > max_times:
		max_times = conta(s_mod)
print(max_times)


from sys import exit
s = [x for x in input()]
if len(s) < 2:
	print(0)
	exit()

def count(s):
	res = 0
	for (i, c) in enumerate(s):
		if i == len(s) - 1:
			continue
		if s[i] == 'V' and s[i + 1] == 'K':
			res += 1
	return res
sol = count(s)
for i in range(len(s)):
	s[i] = 'V' if s[i] == 'K' else 'K'
	sol = max(sol, count(s))
	s[i] = 'V' if s[i] == 'K' else 'K'
print(sol)


import re
s = input()
ss = re.findall('VK', s)
ans = len(ss)
ans2 = re.split('VK', s)
for i in ans2:
	if 'KK' in i or 'VV' in i:
		ans += 1
		break
print(ans)


s = input()
if len(s) == 1:
	print(0)
else:
	x = s.count('VK')
	for i in range(len(s)):
		if s[i] == 'K':
			if i < len(s) - 1 and s[i + 1] == 'K' and (i == 0 or s[i - 1] == 'K'):
				x += 1
				break
		elif i > 0 and s[i - 1] == 'V' and (i == len(s) - 1 or s[i + 1] == 'V'):
			x += 1
			break
	print(x)


import sys
s = input()
count = 0
one = False
if len(s) < 2:
	print(0)
	sys.exit(0)
if len(s) == 2:
	if s == 'VK' or s == 'KK' or s == 'VV':
		print(1)
	else:
		print(0)
	sys.exit(0)
for i in range(len(s)):
	if i > 0 and i < len(s) - 1:
		if s[i:i + 2] == 'KK' or s[i:i + 2] == 'VV':
			if s[i - 1:i + 1] != 'VK' and s[i + 1:i + 3] != 'VK':
				one = True
if (s[0:2] == 'VV' or s[0:2] == 'KK') and (not s[1:3] == 'VK'):
	one = True
if (s[len(s) - 2:len(s)] == 'VV' or s[len(s) - 2:len(s)] == 'KK') and (not s[len(s) - 3:len(s) - 1] == 'VK'):
	one = True
for i in range(len(s) - 1):
	if s[i:i + 2] == 'VK':
		count += 1
if one:
	count += 1
print(count)


s = input()
i = 0
a = s.find('VK')
ans = 0
while a != -1:
	ans += 1
	s = s[:a] + '.' + s[a + 2:]
	a = s.find('VK')
if s.count('VV') > 0 or s.count('KK') > 0:
	ans += 1
print(ans)


s = input().split('VK')
print(len(s) - 1 + any(('VV' in w or 'KK' in w for w in s)))


s = input()
maxi = s.count('VK')
for i in range(len(s)):
	if s[i] == 'K':
		t = s[:i] + 'V' + s[i + 1:]
		maxi = max(maxi, t.count('VK'))
	else:
		t = s[:i] + 'K' + s[i + 1:]
		maxi = max(maxi, t.count('VK'))
print(maxi)


string = input()

def count(string):
	cnt = 0
	for i in range(1, len(string)):
		if string[i] == 'K' and string[i - 1] == 'V':
			cnt += 1
	return cnt
ans = count(string)
for i in range(len(string)):
	new_str = string[:i] + ('K' if string[i] == 'V' else 'V') + string[i + 1:]
	ans = max(ans, count(new_str))
print(ans)


a = input()
s = []
for i in a:
	s.append(i)
k = a.count('VK')
if len(s) < 2:
	print(0)
elif (a.count('VVV') > 0 or s[-2] + s[-1] == 'VV') or (a.count('KKK') > 0 or s[0] + s[1] == 'KK'):
	print(k + 1)
else:
	print(k)


str = input()
ans = str.count('VK')
str = str.replace('VK', 'R')
flag = False
for s in str.split('R'):
	if 'VV' in s or 'KK' in s:
		flag = True
		break
if flag:
	ans += 1
print(ans)


s = list(input())
n = len(s)

def count(s):
	res = 0
	for i in range(n - 1):
		if s[i] == 'V' and s[i + 1] == 'K':
			res += 1
	return res
res = count(s)
for i in range(n):
	if s[i] == 'V':
		s[i] = 'K'
	else:
		s[i] = 'V'
	res = max(res, count(s))
	if s[i] == 'V':
		s[i] = 'K'
	else:
		s[i] = 'V'
print(res)


s = input()
extr = 'VVV' in s or s[-2:] == 'VV' or 'KKK' in s or (s[:2] == 'KK')
print(s.count('VK') + extr)


s = input()
ans = 0
for i in range(len(s) - 1):
	if s[i] + s[i + 1] == 'VK':
		ans += 1
print(ans + int('VVV' in s or 'KKK' in s or s.endswith('VV') or s.startswith('KK')))


data = input()
ans = z = 0
if len(data) > 1:
	for (i, f) in enumerate(data):
		if i is 0:
			continue
		if f is 'K' and data[i - 1] is 'V':
			ans += 1
	for (i, f) in enumerate(data):
		if i is 0:
			continue
		if f is 'V' and data[i - 1] is 'V':
			if i + 1 < len(data) and data[i + 1] is not 'K':
				ans += 1
				break
			elif i + 1 >= len(data):
				ans += 1
				break
		elif f is 'K':
			if data[i - 1] is 'V':
				continue
			if i > 1 and data[i - 2] is 'K':
				ans += 1
				break
			elif i <= 1:
				ans += 1
				break
print(ans)


import sys
import math
import collections
import heapq
input = sys.stdin.readline
s = input()
n = len(s) - 1
c = s.count('VK')
for i in range(n):
	if s[i] == 'V':
		s1 = s[:i] + 'K' + s[i + 1:]
	else:
		s1 = s[:i] + 'V' + s[i + 1:]
	c = max(c, s1.count('VK'))
print(c)


X = input()
VK = X.count('VK')
Count = 0
Size = len(X)
i = Size - 1
while i >= 1:
	Count += 1 if X[i - 1] + X[i] == 'VV' else 0
	i = i - 2 if X[i - 1] + X[i] in ['VV', 'VK'] else i - 1
i = 0
while i < Size - 1:
	Count += 1 if X[i] + X[i + 1] == 'KK' else 0
	i = i + 2 if X[i] + X[i + 1] in ['KK', 'VK'] else i + 1
print(VK + min(Count, 1))


s = input().lower()
maxf = s.count('vk')
for i in range(len(s)):
	if s[i] == 'v':
		sc = s[:i] + 'k' + s[i + 1:]
	if s[i] == 'k':
		sc = s[:i] + 'v' + s[i + 1:]
	k = sc.count('vk')
	if k > maxf:
		maxf = k
print(maxf)


a = input()
b = [a.count('VK')]
for i in range(len(a)):
	s = list(a)
	s[i] = 'K' if a[i] == 'V' else 'V'
	b += [''.join(s).count('VK')]
print(max(b))


count = 0
countk = 0
countv = 0

def st0(List, i):
	global countk
	temp = 0
	while i < len(List) and List[i] == 'K':
		temp += 1
		i += 1
	countk = max(countk, temp)
	if i == len(List):
		return
	st1(List, i + 1)

def st1(List, i):
	global count
	if i < len(List) and List[i] == 'K':
		count += 1
		st0(List, i + 1)
	elif i < len(List) and List[i] == 'V':
		st2(List, i + 1)
	elif i == len(List):
		return

def st2(List, i):
	global countv
	global count
	temp = 2
	while i < len(List) and List[i] == 'V':
		temp += 1
		i += 1
	if i == len(List):
		countv = max(temp, countv)
		return
	elif List[i] == 'K':
		count += 1
		temp -= 1
		countv = max(temp, countv)
		st0(List, i + 1)
List = list(input().strip())
try:
	st0(List, 0)
except:
	pass
countk = max(countv - 1, countk - 1)
if countk > 0:
	count += 1
print(count)


import pdb
keyboard_input = input()
minimal = str(keyboard_input).count('VK')
for (index, char) in enumerate(keyboard_input):
	current = keyboard_input[:index]
	if char == 'V':
		current += 'K'
	else:
		current += 'V'
	current += keyboard_input[index + 1:]
	minimal = max(minimal, current.count('VK'))
print(minimal)


s = input()
s = list(s)
max_ans = -1
cur_ans = 0
for j in range(1, len(s)):
	if s[j] == 'K' and s[j - 1] == 'V':
		cur_ans += 1
max_ans = max(max_ans, cur_ans)
for i in range(len(s)):
	s1 = list(s)
	cur_ans = 0
	if s1[i] == 'V':
		s1[i] = 'K'
	else:
		s1[i] = 'V'
	for j in range(1, len(s1)):
		if s1[j] == 'K' and s1[j - 1] == 'V':
			cur_ans += 1
	max_ans = max(max_ans, cur_ans)
print(max_ans)


s = input()
a = s
c = s.count('VK')
for i in range(len(s)):
	a = s[:i] + ('V' if s[i] == 'K' else 'K') + s[i + 1:]
	c = max(c, a.count('VK'))
print(c)


from sys import stdin, stdout
x = stdin.readline().rstrip()
count = 0
change = False
for idx in range(len(x)):
	if x[idx] == 'V' and idx < len(x) - 1:
		if x[idx + 1] == 'K':
			count += 1
		elif x[idx + 1] == 'V':
			if idx + 1 == len(x) - 1:
				if change == False:
					change = True
					count += 1
			elif x[idx + 2] == 'K':
				continue
			elif x[idx + 2] == 'V' and change == False:
				count += 1
				change = True
	elif x[idx] == 'K' and idx > 0:
		if x[idx - 1] == 'K':
			if idx == 1:
				count += 1
				change = True
			elif x[idx - 2] == 'K' and change == False:
				count += 1
				change = True
print(str(count))


def count(s):
	result = 0
	for i in range(len(s) - 1):
		if s[i:i + 2] == ['v', 'k']:
			result += 1
	return result
s = list(input().lower())
before = count(s)
maximal = before
for i in range(len(s)):
	copy = list(s)
	if copy[i] == 'v':
		copy[i] = 'k'
	else:
		copy[i] = 'v'
	after = count(copy)
	if after > before:
		maximal = after
print(maximal)


s = input()
i = 0
ans = 0
yet = False
if len(s) == 1:
	print(0)
	exit(0)
ans = s.count('VK')
s = s.replace('VK', 'ZZ')
while i < len(s) - 1:
	if s[i] == 'V' and s[i + 1] == 'V':
		ans += 1
		break
	elif s[i] == 'K' and s[i + 1] == 'K':
		ans += 1
		break
	i += 1
print(ans)


def naive_realization():
	s = input()
	count = s.count('VK')
	n = len(s)
	for i in range(n):
		copy_s = list(s[:])
		copy_s[i] = 'V'
		copy_s_str = ''.join(copy_s)
		count = max(count, copy_s_str.count('VK'))
	for i in range(n):
		copy_s = list(s[:])
		copy_s[i] = 'K'
		copy_s_str = ''.join(copy_s)
		count = max(count, copy_s_str.count('VK'))
	print(count)
naive_realization()


l = input().strip()
occur = 0
chance = 1
l = 'K' + l + 'V'
for i in range(1, len(l) - 2):
	if l[i:i + 2] == 'VK':
		occur += 1
	elif l[i:i + 2] == 'VV' and l[i + 2] != 'K' and (chance != 0):
		occur += 1
		chance -= 1
	elif l[i:i + 2] == 'KK' and l[i - 1] != 'V' and (chance != 0):
		occur += 1
		chance -= 1
print(occur)


s = input()
res = s.count('VK')
buf = ''
for i in range(len(s)):
	if s[i] == 'V':
		buf = s[:i] + 'K' + s[i + 1:]
	else:
		buf = s[:i] + 'V' + s[i + 1:]
	res = max(res, buf.count('VK'))
print(res, end='')


s = input()
ans = s.count('VK')
f = s[-2:] == 'VV' or s[:2] == 'KK' or s.find('VVV') != -1 or (s.find('KKK') != -1)
if f:
	ans += 1
print(ans)


s = str(input())
test = s.count('VK')
strs = s.replace('VK', 'JJ')
for i in range(len(strs)):
	if strs[i] == 'K':
		tmp = list(strs)
		tmp[i] = 'V'
		r = ''.join(tmp)
		if r.count('VK') >= 1:
			test = test + 1
			break
	if strs[i] == 'V':
		tmp = list(strs)
		tmp[i] = 'K'
		r = ''.join(tmp)
		if r.count('VK') >= 1:
			test = test + 1
			break
print(test)


def count_substrings(a, b):
	count = 0
	i = -1
	while True:
		i = a.find(b, i + 1)
		if i == -1:
			return count
		count += 1
s = str(input())
max = count_substrings(s, 'VK')
if len(s) == 1:
	print(0)
else:
	for i in range(len(s)):
		if s[i] == 'V':
			q = count_substrings(str(s[:i] + 'K' + s[i + 1:]), 'VK')
			if q > max:
				max = q
		else:
			q = count_substrings(str(s[:i] + 'V' + s[i + 1:]), 'VK')
			if q > max:
				max = q
	print(max)


s = list(input())
n = len(s)
(x, y) = (0, 0)
for i in range(n - 1):
	if s[i] == 'V' and s[i + 1] == 'K':
		(s[i], s[i + 1]) = ('k', 'k')
		x = x + 1
s = ''.join(s)
if 'VV' in s or 'KK' in s:
	x = x + 1
print(x)


string = input()
ans = string.count('VK')
for i in range(len(string)):
	new_str = string[:i] + ('K' if string[i] == 'V' else 'V') + string[i + 1:]
	ans = max(ans, new_str.count('VK'))
print(ans)


s = input()
a = s.count('VK')
s = s.replace('VK', ' ')
a += 1 if 'VV' in s or 'KK' in s else 0
print(a)


s = str(input())
m = s.count('VK')
for i in range(len(s)):
	if s[i] == 'V':
		t = 'K'
	else:
		t = 'V'
	temp = s[:i] + t + s[i + 1:]
	if temp.count('VK') > m:
		m = temp.count('VK')
print(m)


s = input()
n = len(s)
cnt = 0
flag = 1
light = [1 for j in range(n)]
i = 0
while i < n:
	if i < n - 1 and s[i] == 'V' and (s[i + 1] == 'K'):
		cnt += 1
		light[i] = light[i + 1] = 0
		i += 2
	else:
		i += 1
i = 0
while i < n and flag:
	if i < n - 1 and s[i] == 'V' and (s[i + 1] == 'V') and light[i] and light[i + 1]:
		cnt += 1
		flag = 0
	elif i < n - 1 and s[i] == 'K' and (s[i + 1] == 'K') and light[i] and light[i + 1]:
		cnt += 1
		flag = 0
	else:
		i += 1
print(cnt)


def main():
	s = input()
	c = s.count('VK')
	if s.find('VVV') >= 0 or s.find('KKK') >= 0 or s[:2] == 'KK' or (s[-2:] == 'VV'):
		c += 1
	print(c)
main()


import re

def solve():
	s = input()
	m = 0
	for i in range(len(s)):
		m = max(m, len(re.findall('VK', s[:i] + 'V' + s[i + 1:])))
		m = max(m, len(re.findall('VK', s[:i] + 'K' + s[i + 1:])))
	print(m)
solve()


s = list(input())
b = []
ans = 0
i = 1
while i < len(s):
	if s[i] == 'K' and s[i - 1] == 'V':
		ans += 1
		b.append(i)
		b.append(i - 1)
		i += 2
	else:
		i += 1
i = 1
while i < len(s):
	if (s[i] == 'V' and s[i - 1] == 'V' or (s[i] == 'K' and s[i - 1] == 'K')) and (b.count(i) == 0 and b.count(i - 1) == 0):
		ans += 1
		break
	else:
		i += 1
print(ans)


s = input()
x = s.count('VK')
n = len(s)
if s[0:2] == 'KK' or s[n - 2:n] == 'VV':
	print(x + 1)
else:
	b = s.find('VVV')
	c = s.find('KKK')
	if b != -1 or c != -1:
		print(x + 1)
	else:
		print(x)


s = input()
s = s.replace('VK', 'A')
sum = 0
if 'KK' in s or 'VV' in s:
	sum = 1
while len(s) > 0 and s.find('A') != -1:
	sum += 1
	s = s[s.find('A') + 1:]
print(sum)


arr = [c for c in input()]
count = 0
for i in range(len(arr)):
	if i + 1 < len(arr):
		if 'V' == arr[i] and 'K' == arr[i + 1]:
			count += 1
			arr[i] = '_'
			arr[i + 1] = '_'
string = ''.join(arr)
if 'VV' in string or 'KK' in string:
	count += 1
print(count)


s = input()
s = s.replace('VK', 'AA')
z = s.count('A') // 2
s = s.replace('VV', 'X')
s = s.replace('KK', 'X')
if 'X' in s:
	z += 1
print(z)


s = list(input())
ans = 0
for i in range(len(s)):
	temp = s[i]
	s[i] = 'V'
	ans = max(ans, ''.join(s).count('VK'))
	s[i] = temp
for i in range(len(s)):
	temp = s[i]
	s[i] = 'K'
	ans = max(ans, ''.join(s).count('VK'))
	s[i] = temp
print(ans)


class VK:
	st = ''
	count = 0

	def __init__(self, st):
		self.st = st
		self.calc()

	def calc(self):
		self.count = self.st.count('VK')
		self.st = self.st.replace('VK', '_')
		if 'VV' in self.st or 'KK' in self.st:
			self.count += 1
		print(self.count)

def Main():
	st = input('')
	inp = VK(st)
Main()


import sys

def main():
	s = sys.stdin.readline().rstrip()
	result = 0
	for i in range(len(s) - 1):
		if s[i:i + 2] == 'VK':
			result += 1
	if s.startswith('KK') or s.endswith('VV') or 'VKKK' in s or ('VVV' in s):
		result += 1
	sys.stdout.write(str(result) + '\n')
main()


s = list(input())
c = 0
i = 0
while i < len(s) - 1:
	if s[i] == 'V' and s[i + 1] == 'K':
		s[i] = s[i + 1] = '-'
		c += 1
		i += 2
	else:
		i += 1
s = ''.join(s)
if 'VV' in s or 'KK' in s:
	c += 1
print(c)


l = input()
s = []
for i in l:
	if i == 'V':
		s.append(1)
	else:
		s.append(0)
ls = len(s)
i = 0
maxc = 0
c = 0
while i + 1 < ls:
	if s[i] == 1 and s[i + 1] == 0:
		c += 1
	i += 1
maxc = max(maxc, c)
j = 0
while j < ls:
	if s[j] == 1:
		s[j] = 0
	else:
		s[j] = 1
	i = 0
	c = 0
	while i + 1 < ls:
		if s[i] == 1 and s[i + 1] == 0:
			c += 1
		i += 1
	maxc = max(c, maxc)
	if s[j] == 1:
		s[j] = 0
	else:
		s[j] = 1
	j += 1
print(maxc)


s = input()
n = len(s)
num = 0
rec = []
i = 0
while i < n:
	if i < n - 1 and s[i] == 'V' and (s[i + 1] == 'K'):
		i += 2
		num += 1
	else:
		rec.append(i)
		i += 1
for k in range(len(rec) - 1):
	if rec[k + 1] - rec[k] == 1 and s[rec[k]] == 'V' and (s[rec[k + 1]] == 'V') or (rec[k + 1] - rec[k] == 1 and s[rec[k]] == 'K' and (s[rec[k + 1]] == 'K')):
		num += 1
		break
print(num)


s = input()
res = max(((s[:i] + j + s[i + 1:]).count('VK') for j in 'VK' for i in range(len(s))))
print(res)


s = input()
c = s.count('VK')
s = s.replace('VK', 'ms')
if 'VV' in s or 'KK' in s:
	c += 1
print(c)


s = input()
import copy
result = s.count('vk')
for i in range(len(s)):
	news = copy.copy(s)
	news = list(news)
	news[i] = 'V'
	news = ''.join(news)
	result = max(result, news.count('VK'))
for i in range(len(s)):
	news = copy.copy(s)
	news = list(news)
	news[i] = 'K'
	news = ''.join(news)
	result = max(result, news.count('VK'))
print(result)


string = input()
length = len(string)
maximum = 0
j = 0
for i in range(length - 1):
	if string[i] == 'V' and string[i + 1] == 'K':
		j += 1
if j > maximum:
	maximum = j
if string[0] == 'V':
	string = 'K' + string[1:]
else:
	string = 'V' + string[1:]
j = 0
for i in range(length - 1):
	if string[i] == 'V' and string[i + 1] == 'K':
		j += 1
if j > maximum:
	maximum = j
for counter in range(1, length):
	if string[counter - 1] == 'V':
		string = string[:counter - 1] + 'K' + string[counter:]
	else:
		string = string[:counter - 1] + 'V' + string[counter:]
	if string[counter] == 'V':
		string = string[:counter] + 'K' + string[counter + 1:]
	else:
		string = string[:counter] + 'V' + string[counter + 1:]
	j = 0
	for i in range(length - 1):
		if string[i] == 'V' and string[i + 1] == 'K':
			j += 1
	if j > maximum:
		maximum = j
print(maximum)


s = input()
n = len(s)
q = 0
vk = 0
if n == 1:
	print(0)
	exit()
for i in range(n - 1):
	if s[i] == 'V' and s[i + 1] == 'K':
		vk += 1
for i in range(n - 2):
	if s[i] == 'V' and s[i + 1] == 'V' and (s[i + 2] == 'V') or (s[i] == 'K' and s[i + 1] == 'K' and (s[i + 2] == 'K')):
		q += 1
if s[0] == 'K' and s[1] == 'K' or (s[n - 2] == 'V' and s[n - 1] == 'V'):
	q += 1
if q == 0:
	print(vk)
else:
	print(vk + 1)


seq = input()
ans = seq.count('VK')
for i in range(len(seq)):
	if 0 < i and seq[i] == 'V':
		if seq[i - 1] == 'V':
			if i + 1 == len(seq) or seq[i:i + 2] != 'VK':
				exit(print(ans + 1))
	if i + 1 < len(seq) and seq[i] == 'K':
		if seq[i + 1] == 'K':
			if i == 0 or seq[i - 1:i + 1] != 'VK':
				exit(print(ans + 1))
print(ans)


word = input()
l = []
for i in range(len(word)):
	for j in 'VK':
		l.append((word[:i] + j + word[i + 1:]).count('VK'))
print(max(l))


s = input()
r = s.count('VK')
if s.find('KKK') >= 0:
	r += 1
elif s[:2] == 'KK':
	r += 1
elif s.find('VVV') >= 0:
	r += 1
elif s[-2:] == 'VV':
	r += 1
print(r)


s = input()
num = 0
p = 0
for i in range(len(s) - 1):
	if s[i] == 'V' and s[i + 1] == 'K':
		num += 1
	if i + 2 < len(s) and s[i] == 'V' and (s[i + 1] == 'V') and (s[i + 2] == 'V'):
		p = 1
	if i + 2 < len(s) and s[i] == 'K' and (s[i + 1] == 'K') and (s[i + 2] == 'K'):
		p = 1
if len(s) > 1 and s[-1] == 'V' and (s[-2] == 'V'):
	p = 1
if len(s) > 1 and s[0] == 'K' and (s[1] == 'K'):
	p = 1
print(num + p)


import re
j = input()
reg = re.compile('VK')
rego = reg.sub('*', j)
sstar = re.compile('\\*')
rs = sstar.findall(rego)
l = len(rs)
try:
	x = re.compile('VV|KK')
	rese = x.search(rego)
	if rese:
		print(l + 1)
	else:
		print(l)
except:
	pass


from sys import stdin, stdout

def ri():
	return map(int, input().split())
s = input()
l = len(s)
v = [0 for i in range(l)]
if l == 1:
	print(0)
	exit()
count = 0
for i in range(l - 1):
	if v[i]:
		continue
	if s[i:i + 2] == 'VK':
		v[i] = 1
		v[i + 1] = 1
		count += 1
for i in range(l - 1):
	if v[i] or v[i + 1]:
		continue
	if s[i:i + 2] == 'VV' or s[i:i + 2] == 'KK':
		count += 1
		break
print(count)


s = input()
n = len(s)

def vk(s, j, mode):
	r = 0
	if len(s) == 1:
		return 0
	else:
		if mode == 'V':
			for i in range(len(s) - 1):
				if i != j and i + 1 != j:
					if s[i] == 'V' and s[i + 1] == 'K':
						r += 1
					continue
				if i == j and s[i + 1] == 'K':
					r += 1
			return r
		if mode == 'K':
			for i in range(len(s) - 1):
				if i != j and i + 1 != j:
					if s[i] == 'V' and s[i + 1] == 'K':
						r += 1
					continue
				if i + 1 == j and s[i] == 'V':
					r += 1
			return r
ans = vk(s, 200, 'V')
for i in range(n):
	ans = max(ans, vk(s, i, 'V'))
	ans = max(ans, vk(s, i, 'K'))
print(ans)


s = input()
if len(s) == 1:
	print(0)
elif len(s) == 2:
	if s == 'KV':
		print(0)
	else:
		print(1)
else:
	count = s.count('VK')
	if s.find('VVV') != -1 or s.find('KKK') != -1 or s[:2] == 'KK' or (s[-2:] == 'VV'):
		print(count + 1)
	else:
		print(count)


import sys
import re

def solve():
	str = input()
	sadd = 0
	stot = 0
	if (str[0:2] == 'KK') | (str[~1:] == 'VV'):
		sadd = 1
	elif (str.find('KKK') > -1) | (str.find('VVV') > -1):
		sadd = 1
	mm = [m.start() for m in re.finditer('VK', str)]
	print(len(mm) + sadd)
solve()


S = list(input())

def count(S):
	y = 0
	for i in range(1, len(S)):
		if S[i] == 'K' and S[i - 1] == 'V':
			y += 1
	return y
most = count(S)
for i in range(0, len(S)):
	S[i] = 'V' if S[i] == 'K' else 'K'
	most = max(most, count(S))
	S[i] = 'V' if S[i] == 'K' else 'K'
print(most)


s = input()
t = s.count('VK')
k = s.split('VK')
z = 0
for m in k:
	if m.count('V') >= 2 or m.count('K') >= 2:
		print(t + 1)
		z = -1
		break
if z != -1:
	print(t)


s = input()
n = len(s)
f = lambda s: sum((s[i:i + 2] == 'VK' for i in range(n - 1)))
ans = 0
for i in range(n):
	t = s[:i] + 'V' + s[i + 1:]
	ans = max(ans, f(t))
	t = s[:i] + 'K' + s[i + 1:]
	ans = max(ans, f(t))
print(ans)


s = input()
count = 0
a = []
a = s.split('VK')
add = 0
for i in a:
	if len(i) > 1 and i != 'KV':
		add = 1
		break
print(s.count('VK') + add)


s = input()
ans = 0
b = 0
x = 0
f = 0
for i in s:
	if i == 'V':
		b += 1
		x = 0
	else:
		if b != 0:
			ans += 1
		b = 0
		x += 1
	if b >= 3 or x >= 3:
		f = 1
len = s.__len__()
if len >= 2:
	if s[0] == 'K' and s[1] == 'K':
		f = 1
	if s[len - 1] == 'V' and s[len - 2] == 'V':
		f = 1
print(ans + f)


import sys
import math
s = input()
cnt = s.count('VK')
if s[:2] == 'KK':
	cnt += 1
elif s[-2:] == 'VV':
	cnt += 1
elif s.find('VVV') >= 0:
	cnt += 1
elif s.find('KKK') >= 0:
	cnt += 1
print(cnt)


s = input()
d = {'V': 'K', 'K': 'V'}
ans = s.count('VK')
for i in range(len(s)):
	ts = s[:i] + d[s[i]] + s[i + 1:]
	ans = max(ans, ts.count('VK'))
print(ans)


a = input()
s = 0
d = []
d1 = []
f = 0
ff = 0
p = []
for i in range(len(a)):
	if i != len(a) - 1:
		if a[i] + a[i + 1] == 'VK':
			s = s + 1
			d.append(i + 1)
			d1.append(i)
for i in range(len(a)):
	if i != len(a) - 1:
		if a[i] + a[i + 1] == 'KK' and i not in d or (a[i] + a[i + 1] == 'VV' and i + 1 not in d1):
			s = s + 1
			break
if len(a) != 1:
	print(s)
else:
	print(0)


s = input()
l = len(s)
s = list(s)
if l == 1:
	print(0)
else:
	c = 0
	f = 0
	i = 0
	while i < l - 1:
		if s[i] == 'V' and s[i + 1] == 'K':
			c += 1
			i += 2
		elif s[i] == 'K' and s[i + 1] == 'V':
			i += 1
		elif f == 0 and s[i] == 'K' and (s[i + 1] == 'K'):
			f = 1
			c += 1
			i += 2
		elif f == 0 and i < l - 2 and (s[i + 2] == 'V'):
			f = 1
			c += 1
			i += 2
		elif f == 0 and i < l - 2 and (s[i + 2] == 'K'):
			i += 1
		elif f == 0:
			c += 1
			f = 1
			i += 2
		else:
			i += 1
	print(c)


s = input()
n = len(s)
z = ''
k = 0
mm = 0
vk = 'VK'
vv = 'VV'
kk = 'KK'
while vk in s:
	m = s.index(vk)
	z = s[:m]
	s = s[m + 2:]
	k += 1
	if vv in z or kk in z:
		mm = 1
if k == 0:
	z = s
if vv in z or kk in z or vv in s or (kk in s):
	mm = 1
print(k + mm)


s = input()
a = s.count('VK')
s = s.replace('VK', '1')
b = s.count('KK')
c = s.count('VV')
if a == 0:
	b = s.count('VV')
	c = s.count('KK')
if c > 0 or b > 0:
	a += 1
print(a)


a = list(input())
t = 0
if len(a) == 1:
	print(0)
else:
	for k in range(len(a) - 1):
		if a[k] == 'V' and a[k + 1] == 'K':
			t += 1
			a[k] = 'm'
			a[k + 1] = 'm'
	for k in range(len(a) - 1):
		if a[k] == 'V' and a[k + 1] == 'V' or (a[k] == 'K' and a[k + 1] == 'K'):
			t += 1
			break
	print(t)


s = input()
if len(s) == 1:
	print('0')
elif 'VKKK' in s or ('KK' in s and s.index('KK') == 0) or 'KKK' in s or ('VVV' in s) or ('VV' in s and len(s) == 2) or (s[len(s) - 3] == 'K' and s[len(s) - 2] == 'V' and (s[len(s) - 1] == 'V')):
	print(s.count('VK') + 1)
else:
	print(s.count('VK'))


source_text = input()
count = source_text.count('VK')
if source_text.count('VVV') != 0 or source_text.count('KKK') != 0 or source_text[0:2] == 'KK' or (source_text[-2:] == 'VV'):
	count += 1
print(count)


s = str(input())
c = 0
c1 = 0
for i in range(len(s) - 1):
	if s[i] == 'V' and s[i + 1] == 'K':
		c += 1
	if i == len(s) - 2:
		if s[i] == 'V' and s[i + 1] == 'V':
			c1 += 1
	elif s[i] == 'V' and s[i + 1] == 'V' and (s[i + 2] != 'K'):
		c1 += 1
	if i != 0:
		if s[i] == 'K' and s[i + 1] == 'K' and (s[i - 1] != 'V'):
			c1 += 1
	if i == 0:
		if s[i] == 'K' and s[i + 1] == 'K':
			c1 += 1
if c1 > 0:
	print(c + 1)
else:
	print(c)


s = input()
gaps = s.split('VK')
print(s.count('VK') + 1 if any((len(gaps[i]) >= 2 and gaps[i] != 'KV' for i in range(len(gaps)))) else s.count('VK'))


s = list(input())
f = 0
i = 0
if len(s) == 2:
	if s[i] == s[i + 1]:
		f = 2
for i in range(len(s) - 2):
	if f == 0 and s[i] == 'V' and (s[i + 1] == 'V') and (s[i + 2] == 'V'):
		s[i + 1] = 'K'
		f = 1
		break
	if f == 0 and s[i] == 'K' and (s[i + 1] == 'K') and (s[i + 2] == 'K'):
		s[i + 1] = 'V'
		f = 1
		break
	if f == 0 and i == 0 and (s[i] == 'K') and (s[i + 1] == 'K'):
		s[i] = 'V'
		f = 1
		break
	if f == 0 and s[len(s) - 2] == 'V' and (s[len(s) - 1] == 'V'):
		s[len(s) - 1] = 'K'
		f = 1
		break
ct = 0
for i in range(len(s) - 1):
	if s[i] == 'V' and s[i + 1] == 'K':
		ct += 1
print(ct) if f != 2 else print(1)


s = input()
l = list(s)

def count(l1):
	a = 0
	for i in range(len(l1) - 1):
		if l1[i] == 'V':
			if l1[i + 1] == 'K':
				a = a + 1
	return a
c = count(list(s))
b = [c]
for i in range(len(l)):
	l1 = l[:]
	l1[i] = 'V'
	a = count(l1)
	b.append(a)
	l1[i] = 'K'
	a = count(l1)
	b.append(a)
max = c
for i in range(len(b)):
	if b[i] > max:
		max = b[i]
print(max)


a = input()

def cnt(s):
	return s.count('VK')
m = cnt(a)
for i in range(len(a)):
	if a[i] == 'K':
		q = 'V'
	else:
		q = 'K'
	m = max(m, cnt(a[:i] + q + a[i + 1:]))
print(m)


s = list(input())
ans = 0
n = len(s)
for i in range(n - 1):
	if s[i] == 'V' and s[i + 1] == 'K':
		ans += 1
for t in range(len(s)):
	anst = 0
	ss = s[:]
	if ss[t] == 'V':
		ss[t] = 'K'
	else:
		ss[t] = 'V'
	for i in range(n - 1):
		if ss[i] == 'V' and ss[i + 1] == 'K':
			anst += 1
	if anst > ans:
		ans = anst
print(ans)


s = list(input())
i = 0
k = 0
vs = 0
mavs = 0
ks = 0
maks = 0
while i < len(s):
	if s[i] == 'V' and (i + 1 < len(s) and s[i + 1] == 'K'):
		k += 1
		i += 1
		ks = 0
		vs = 0
	elif s[i] == 'V':
		ks = 0
		vs += 1
		if vs > mavs:
			mavs = vs
	elif s[i] == 'K':
		vs = 0
		ks += 1
		if ks > maks:
			maks = ks
	i += 1
if maks >= 2 or mavs >= 2:
	k += 1
print(k)


s = input()
x = s.count('VK')
s = s.replace('VK', '*')
if 'VV' in s or 'KK' in s:
	print(x + 1)
else:
	print(x)


def str_finder(s):
	counter = counter_str(s)
	for i in range(len(s)):
		if s[i] == 'V':
			new = s[:i] + 'K' + s[i + 1:]
		else:
			new = s[:i] + 'V' + s[i + 1:]
		if counter_str(new) > counter:
			counter = counter_str(new)
	return counter

def counter_str(s):
	count = 0
	for i in range(len(s) - 1):
		if s[i] == 'V' and s[i + 1] == 'K':
			count += 1
	return count
n = str(input())
print(str_finder(n))


s = input()
d = dict()
d['V'] = 'K'
d['K'] = 'V'
m = s.count('VK')
s = list(s)
for i in range(len(s)):
	s[i] = d[s[i]]
	m = max(m, ''.join(s).count('VK'))
	s[i] = d[s[i]]
print(m)


a = input()
k = a.count('VK')
b = False
while len(a) != 0:
	n = a.find('VK')
	if n == -1:
		r = a
		a = ''
	else:
		r = a[:n]
		a = a[n + 2:]
	if (r.find('VV') != -1 or r.find('KK') != -1) and b == False:
		b = True
		k += 1
print(k)


S = list(input())
a = 0
b = 0
x = 0
y = 0
for i in range(1, len(S)):
	n = x
	m = y
	if S[i - 1] == 'V' and S[i] == 'V':
		x = x
		y = max(y, a + 1)
	elif S[i - 1] == 'K' and S[i] == 'K':
		x = x
		y = max(y, a + 1)
	elif S[i - 1] == 'V' and S[i] == 'K':
		x = max(x, a + 1)
		y = max(b, b + 1)
	else:
		pass
	a = n
	b = m
print(max(x, y))


s = input()
sl = [i for i in s]
import re
if len(s) == 1:
	print(0)
	exit(0)
l = [k.start() for k in re.finditer('VK', s)]
for i in l:
	sl[i] = 0
	sl[i + 1] = 0
if len(l) == len(s) // 2:
	print(len(s) // 2)
else:
	for i in range(len(sl) - 1):
		if sl[i] == 'V' and sl[i + 1] == 'V' or (sl[i] == 'K' and sl[i + 1] == 'K'):
			print(len(l) + 1)
			exit(0)
	print(len(l))


s = input()
ans = 0
for i in range(len(s)):
	ans = max(ans, s.count('VK'))
	if s[i] == 'V':
		s = s[:i] + 'K' + s[i + 1:len(s)]
		ans = max(ans, s.count('VK'))
		s = s[:i] + 'V' + s[i + 1:len(s)]
	else:
		s = s[:i] + 'V' + s[i + 1:len(s)]
		ans = max(ans, s.count('VK'))
		s = s[:i] + 'K' + s[i + 1:len(s)]
print(ans)


s = str(input())
a = s.count('VK')
s = s.replace('VK', 'TP')
if s.find('VV') != -1 or s.find('KK') != -1:
	a += 1
print(a)


s = input()
c = s.count('VK')
s = s.replace('VK', '_')
if s.count('VV') or s.count('KK'):
	c += 1
print(c)


a = input()
c = a.count('VK')
a = a.replace('VK', '_')
if 'VV' in a or 'KK' in a:
	c += 1
print(c)


def alternate(c):
	if c == 'V':
		return 'K'
	return 'V'
s = input()
res = s.count('VK')
for i in range(len(s)):
	res = max(res, (s[:i] + alternate(s[i]) + s[i + 1:]).count('VK'))
print(res)


s = input()
if len(s) == 1:
	print(0)
	exit()
elif len(s) == 2:
	if s == 'KV':
		print(0)
		exit()
	else:
		print(1)
		exit()
f = True
x = 0
if (s[0] == 'V') & (s[1] == 'K'):
	x = 1
elif (s[0] == 'K') & (s[1] == 'K'):
	f = False
if (s[-1] == 'V') & (s[-2] == 'V'):
	f = False
for index in range(2, len(s)):
	if s[index] == 'K':
		if s[index - 1] == 'V':
			x += 1
		elif s[index - 2] == 'K':
			f = False
	elif (s[index - 1] == 'V') & (s[index - 2] == 'V'):
		f = False
if f:
	print(x)
else:
	print(x + 1)


import sys

def countAndReplace(s, needle, repl):
	assert len(needle) == len(repl)
	cnt = 0
	offset = 0
	while True:
		p = s.find(needle, offset)
		if -1 == p:
			break
		cnt += 1
		offset = p + len(needle)
		s = s[0:p] + repl + s[offset:]
	return (s, cnt)
s = sys.stdin.readline().strip()
(s, cnt) = countAndReplace(s, 'VK', 'XX')
for i in range(0, len(s)):
	c = s[i]
	if 'X' == c:
		continue
	if 'V' == c and i > 0 and (s[i - 1] == 'V'):
		cnt += 1
		break
	if 'K' == c and i > 0 and (s[i - 1] == 'K'):
		cnt += 1
		break
print(cnt)


string = input()
ln = len(string)
if ln == 1:
	print(0)
elif ln == 2:
	if string != 'KV':
		print(1)
	else:
		print(0)
else:
	chang = ['VVV', 'KKK']
	add = 0
	for i in chang:
		if string.count(i):
			add = 1
			break
	if string[:3] == 'KKV' or string[-3:] == 'KVV':
		add = 1
	print(string.count('VK') + add)


import sys
import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list or type(n) is str:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def revn(n):
	return int(str(n)[::-1])

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base=3):
	newnumber = ''
	while number > 0:
		newnumber = str(number % base) + newnumber
		number //= base
	return newnumber
s = input()
lens = len(s)
ans = s.count('VK')
s = list(s)
for i in range(lens):
	t = s.copy()
	if t[i] == 'V':
		t[i] = 'K'
	else:
		t[i] = 'V'
	temp = 0
	for j in range(lens - 1):
		if t[j] == 'V' and t[j + 1] == 'K':
			temp += 1
	ans = max(ans, temp)
print(ans)


s = input()
t = s.count('VK')
p = t
while p != 0:
	s = s.replace('VK', 'R')
	p -= 1
if s.count('VV') != 0 or s.count('KK') != 0:
	t += 1
print(t)


s = input().strip()
ls = len(s)
if ls == 1:
	print(0)
else:
	ret = 0
	if s[0] == 'K' and s[1] == 'K':
		ret += 1
	elif s[-1] == 'V' and s[-2] == 'V':
		ret += 1
	else:
		for i in range(ls - 2):
			if s[i] == s[i + 1] and s[i + 1] == s[i + 2]:
				ret += 1
				break
	for i in range(ls - 1):
		if s[i] == 'V' and s[i + 1] == 'K':
			ret += 1
	print(ret)


import sys
__author__ = 'buyvich'

def calc_substr(s, sub):
	max_cnt = s.count(sub)
	for i in range(len(s)):
		l = list(s)
		for k in 'VK':
			l[i] = k
			tmp_cnt = ''.join(l).count(sub)
			max_cnt = max(max_cnt, tmp_cnt)
	return max_cnt
s = sys.stdin.readline().strip()
r = calc_substr(s, 'VK')
sys.stdout.write('%s' % r)


from sys import maxsize, stdout, stdin, stderr
import re
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
S = lambda : stdin.readline().replace('\n', '').strip()

def grid(r, c):
	return [lint() for i in range(r)]

def debug(*args, c=6):
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=stderr)
stpr = lambda x: stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
s = list(S())
arr = []
m = ''.join(s).count('VK')
for i in range(len(s)):
	if s[i] == 'V':
		s[i] = 'K'
	elif s[i] == 'K':
		s[i] = 'V'
	x = ''.join(s).count('VK')
	m = max(x, m)
	if s[i] == 'V':
		s[i] = 'K'
	elif s[i] == 'K':
		s[i] = 'V'
print(m)


def f(S):
	ans = 0
	for i in range(1, len(S)):
		if S[i - 1] == 'V' and S[i] == 'K':
			ans += 1
	return ans
S = list(input())
ans = f(S)
D = {'V': 'K', 'K': 'V'}
for i in range(len(S)):
	S[i] = D[S[i]]
	ans = max(ans, f(S))
	S[i] = D[S[i]]
print(ans)


s = input()
x = s.count('VK')
for i in range(len(s)):
	v = s[:]
	if s[i] == 'V':
		s = s[:i] + 'K' + s[i + 1:]
	else:
		s = s[:i] + 'V' + s[i + 1:]
	if s.count('VK') > x:
		x += 1
		break
	s = v[:]
print(x)


s = input()
b = c = 0
c = s.count('VK')
if s == 'V' or s == 'K':
	print(c)
elif s == 'VV' or s == 'KK':
	c = 1
	print(c)
elif 'VVV' in s or 'KKK' in s:
	c = c + 1
	print(c)
elif 'KKV' == s[:3]:
	c = c + 1
	print(c)
elif 'KVV' == s[len(s) - 3:]:
	c = c + 1
	print(c)
else:
	print(c)


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
str1 = input().rstrip()
count1 = 0
str2 = 0
for i in range(len(str1) - 1):
	if str1[i] == 'V' and str1[i + 1] == 'K':
		count1 += 1
	if i == len(str1) - 2:
		if str1[i] == 'V' and str1[i + 1] == 'V':
			str2 = 1
		elif str1[i] == 'K' and str1[i + 1] == 'K':
			if str1[i - 1] != 'V':
				str2 = 1
	elif i == 0:
		if str1[i] == 'K' and str1[i + 1] == 'K':
			str2 = 1
		elif str1[i] == 'V' and str1[i + 1] == 'V':
			if str1[i + 1] == 'V' and str1[i + 2] != 'K':
				str2 = 1
	elif str1[i] == 'V' and str1[i + 1] == 'V':
		if str1[i + 1] == 'V' and str1[i + 2] != 'K':
			str2 = 1
	elif str1[i] == 'K' and str1[i + 1] == 'K':
		if str1[i - 1] != 'V':
			str2 = 1
print(count1 + str2)


s = input()
n = 0
i = 0
flag = 0
while i < len(s):
	if s[i] == 'V':
		if i + 1 >= len(s):
			break
		elif s[i + 1] == 'K':
			n += 1
			i += 2
		elif i + 2 >= len(s):
			flag = 1
			break
		elif s[i + 2] == 'V':
			flag = 1
			i += 2
		else:
			i += 1
	else:
		if i > 1:
			if s[i - 1] == 'K' and s[i - 2] == 'K':
				flag = 1
		elif i == 1:
			if s[i - 1] == 'K':
				flag = 1
		i += 1
if flag == 1:
	n += 1
print(n)


s = input()
stringSplit = list(s)
count = 0
for i in range(len(stringSplit) - 1):
	if stringSplit[i] == 'V' and stringSplit[i + 1] == 'K':
		stringSplit[i] = 0
		stringSplit[i + 1] = 0
		count = count + 1
for i in range(len(stringSplit)):
	if i != 0 and stringSplit[i] == 'K':
		if stringSplit[i - 1] != 0:
			count = count + 1
			break
	if stringSplit[i] == 'V' and i != len(stringSplit) - 1:
		if stringSplit[i + 1] != 0:
			count = count + 1
			break
print(count)


import sys, itertools, math

def ia():
	return [int(i) for i in sys.stdin.readline().strip().split(' ')]

def ii():
	return int(sys.stdin.readline().strip())

def istr():
	return sys.stdin.readline().strip()
s = list(istr())
ans = 0
for i in range(len(s) - 1):
	if s[i] == 'V' and s[i + 1] == 'K':
		ans += 1
		(s[i], s[i + 1]) = ('x', 'x')
s = ''.join(s)
if 'VV' in s or 'KK' in s:
	ans += 1
print(ans)


x = input()
t = x.count('VK')
l = x.replace('VK', ' ')
if 'KK' in l:
	t += 1
	print(t)
elif 'VV' in l:
	t += 1
	print(t)
else:
	print(t)


a = input()
l = len(a)
t = 0
j = 0
for i in range(1, l):
	if a[i] == 'K' and a[i - 1] == 'V':
		t += 1
for i in range(2, l):
	if a[i] == a[i - 1] and a[i] == a[i - 2]:
		j = 1
		break
if a == 'VV' or a == 'KK' or a[0:2] == 'KK' or (a[-2:] == 'VV'):
	j = 1
print(t + j)


from sys import maxsize, stdout, stdin, stderr
import re
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
S = lambda : stdin.readline().replace('\n', '').strip()

def grid(r, c):
	return [lint() for i in range(r)]

def debug(*args, c=6):
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=stderr)
stpr = lambda x: stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
s = S()
m = s.count('VK')
s = s.replace('VK', ' ')
if 'VV' in s or 'KK' in s:
	m += 1
print(m)


s = input()
n = len(s)
v = 0
k = 0
count = 0
flag = 0
fl = 0
for i in range(n):
	if s[i] == 'V' and (not i == len(s) - 1):
		if s[i + 1] == 'K':
			count += 1
			v = 0
			k = 0
			fl = 1
		else:
			v += 1
			k = 0
	elif s[i] == 'V' and i == len(s) - 1:
		v += 1
	elif fl == 0 and s[i] == 'K':
		k += 1
	elif fl == 1 and s[i] == 'K':
		fl = 0
	if (v >= 2 or k >= 2) and flag == 0:
		count += 1
		flag = 1
print(count)


x = input()
y = 0
z = 1
if not len(x) == 1:
	for i in range(len(x) - 1):
		if x[i] == 'V' and x[i + 1] == 'K':
			y += 1
	x += 'V'
	for i in range(len(x) - 2):
		if x[i] == 'V' and x[i + 1] == 'V' and (x[i + 2] == 'V'):
			y += 1
			z = 0
			break
x = 'K' + x
if z:
	for i in range(len(x) - 2):
		if x[i] == 'K' and x[i + 1] == 'K' and (x[i + 2] == 'K'):
			y += 1
			break
print(y)


import math
s = list(input())
vk = 0
for i in range(len(s) - 1):
	if s[i] == 'V' and s[i + 1] == 'K':
		vk += 1
		s[i] = 0
		s[i + 1] = 0
for i in range(len(s) - 1):
	if s[i] != 0 and s[i + 1] != 0:
		if s[i] == 'K' and s[i + 1] == 'V':
			continue
		else:
			vk += 1
			break
print(vk)


def get(s):
	res = 0
	for i in range(len(s) - 1):
		if s[i] == 'V' and s[i + 1] == 'K':
			res += 1
	return res
s = input()
l = list(s)
ans = 0
for i in range(len(l)):
	st = l[i]
	l[i] = 'V'
	ans = max(ans, get(''.join(l)))
	l[i] = 'K'
	ans = max(ans, get(''.join(l)))
	l[i] = st
print(ans)


l = input('')
count = l.count('VK')
length = len(l)
if length == 1:
	count = 0
elif length == 2:
	if 'KV' in l:
		count = 0
	else:
		count = 1
elif l[0] + l[1] == 'KK':
	count = count + 1
elif l[length - 2] + l[length - 1] == 'VV':
	count = count + 1
elif 'VVV' in l:
	count = count + 1
elif 'KKK' in l:
	count = count + 1
print(count)


s = input()
ans = s.count('VK')
for subs in s.split('VK'):
	if subs != '' and subs != 'V' and (subs != 'K') and (subs != 'KV'):
		ans += 1
		break
print(ans)


s = str(input())
test = s.count('VK')
strs = s.replace('VK', 'JJ')
if 'VV' in strs or 'KK' in strs:
	test = test + 1
print(test)


vk = input()
vk = list(vk)
vk.append(0)
changed = False
i = 0
count = 0
while True:
	if i >= len(vk) - 2:
		break
	if vk[i] == 'V':
		if vk[i + 1] == 'K':
			count += 1
			i += 2
			continue
		elif changed is False and (vk[i + 2] == 'V' or vk[i + 2] == 0):
			changed = True
			count += 1
			i += 2
			continue
	elif changed is False and vk[i + 1] == 'K':
		count += 1
		changed = True
		i += 2
		continue
	i += 1
print(count)


from sys import stdin, stdout
a = stdin.readline().rstrip()
a = list(a)
vkCount = 0
change = False
if a[0:2] == list('KK'):
	change = True
	a[0] = 'V'
elif a[-2:] == list('VV'):
	change = True
	a[-1] = 'K'
i = 0
while i < len(a) - 2 and (not change):
	if a[i:i + 3] == list('VVV'):
		a[i + 1] = 'K'
		change = True
	elif a[i:i + 3] == list('KKK'):
		a[i + 1] = 'V'
		change = True
	i += 1
for i in range(len(a) - 1):
	if a[i:i + 2] == list('VK'):
		vkCount += 1
print(vkCount)


def counting(s):
	(lst, count) = (list(s), 0)
	for i in range(len(lst)):
		if lst[i:i + 2] == ['V', 'K']:
			count += 1
	return count

def klava(t):
	a = list()
	for i in range(len(t)):
		if t[i] == 'V':
			z = t[0:i] + 'K' + t[i + 1:]
			a.append(counting(z))
		elif t[i] == 'K':
			z = t[0:i] + 'V' + t[i + 1:]
			a.append(counting(z))
	a.append(counting(t))
	return max(a)
print(klava(input()))


s = input()
i = 1
k = s.count('VK')
s = s.replace('VK', ' ')
for ((i1, c1), (i2, c2)) in zip(enumerate(s), enumerate(s[1:])):
	if c1 == 'V' and c2 == 'V':
		k += 1
		break
	if c1 == 'K' and c2 == 'K':
		k += 1
		break
print(k)


s = input().strip()
c = 0
if len(s) > 2:
	c += s.count('VK')
	l = s.split('VK')
	for i in l:
		if 'VV' in i or 'KK' in i:
			c += 1
			break
elif len(s) == 2 and s != 'KV':
	c = 1
print(c)


s = input()
p = s.count('VK')
if s.count('KKK') > 0 or s.count('VVV') > 0 or s[-2:] == 'VV' or (s[:2] == 'KK'):
	print(p + 1)
	quit()
print(p)


a = input()
m = a.count('VK')
for i in range(len(a)):
	if a[i] == 'V':
		a = a[:i] + 'K' + a[i + 1:]
	else:
		a = a[:i] + 'V' + a[i + 1:]
	if a.count('VK') > m:
		m = a.count('VK')
	if a[i] == 'V':
		a = a[:i] + 'K' + a[i + 1:]
	else:
		a = a[:i] + 'V' + a[i + 1:]
print(m)


a = input()
b = a.split('VK')
count = 0
count += a.count('VK')
for i in b:
	if i.count('VV') > 0 or i.count('KK') > 0:
		count += 1
		break
print(count)


def main():
	a = input()
	b = {}
	pairs = 0
	max = 0
	b[0] = 0
	for i in range(1, len(a)):
		if a[i] is a[i - 1]:
			b[i] = b[i - 1] + 1
		elif a[i] is 'K':
			pairs += 1
			b[i - 1] -= 1
			b[i] = -1
		else:
			b[i] = 0
	for i in range(1, len(a)):
		if max < b[i]:
			max = b[i]
	if max > 0:
		pairs += 1
	print(pairs)
main()


n = input()
m = n.count('VK')
n = n.replace('VK', 'O')
if 'VV' in n or 'KK' in n:
	m = m + 1
print(m)


import math as mt
import sys, string, bisect
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
d = defaultdict(int)
s = input().strip()
i = 0
f = 0
a = 0
while i < len(s) - 1:
	if s[i] == 'V' and s[i + 1] == 'K':
		a += 1
		i += 2
	elif f == 0:
		if s[i] == 'V' and s[i + 1] == 'V':
			if i + 2 < len(s):
				if s[i + 2] != 'K':
					a += 1
					f = 1
					i += 2
				else:
					i += 1
			else:
				f = 1
				a += 1
				i += 2
		elif s[i] == 'K' and s[i + 1] == 'K':
			if i - 1 >= 0:
				if s[i - 1] != 'V':
					a += 1
					f = 1
					i += 2
				else:
					i += 1
			else:
				f = 1
				a += 1
				i += 2
		else:
			i += 1
	else:
		i += 1
print(a)


s = input()
wyn = 0
prev = s[0]
point = False
add = False
vadd = False
for i in s[1:]:
	if vadd and i == 'K':
		vadd = False
	elif vadd and i == 'V':
		add = True
	if point:
		point = False
	elif i == 'K' and prev == 'V':
		wyn += 1
		point = True
	elif i == 'K' and prev == 'K':
		add = True
	elif i == 'V' and prev == 'V':
		vadd = True
	prev = i
if add or vadd:
	print(wyn + 1)
else:
	print(wyn)


s = input()
a = [x for x in s]
m = {'V': 'K', 'K': 'V'}
mx = s.count('VK')
for i in range(len(s)):
	a[i] = m[a[i]]
	mx = max(mx, ''.join(a).count('VK'))
	a[i] = m[a[i]]
print(mx)


def vkc(s):
	list1 = list(s)
	count = 0
	for i in range(len(s) - 1):
		if list1[i:i + 2] == ['V', 'K']:
			count += 1
	return count
s = str(input())
list1 = []
for i in range(len(s)):
	if s[i] == 'V':
		s1 = s[0:i] + 'K' + s[i + 1:]
		list1.append(vkc(s1))
	elif s[i] == 'K':
		s1 = s[0:i] + 'V' + s[i + 1:]
		list1.append(vkc(s1))
list1.append(vkc(s))
print(max(list1))


import copy
s = list(input())
n = len(s)
ans = 0
for i in range(0, n + 1):
	t = copy.copy(s)
	if i < n:
		if t[i] == 'V':
			t[i] = 'K'
		else:
			t[i] = 'V'
	tot = 0
	for j in range(0, n - 1):
		if t[j] == 'V' and t[j + 1] == 'K':
			tot = tot + 1
	if ans < tot:
		ans = tot
print(ans)


s = input()
res = 0
if len(s) < 2:
	print(0)
else:
	for i in range(len(s) - 1):
		if s[i] == 'V' and s[i + 1] == 'K':
			res += 1
	if 'VVV' in s or s[-2:] == 'VV':
		res += 1
	elif 'KKK' in s or s[:2] == 'KK':
		res += 1
	print(res)


s = list(input().strip())
i = 0
cnt = ''.join(s).count('VK')
indices = []
while i < len(s) - 1:
	if s[i] == 'V' and s[i + 1] == 'K':
		indices.append(i)
		indices.append(i + 1)
		i += 2
	else:
		i += 1
for i in range(len(s) - 1):
	if s[i] == 'V' and s[i + 1] == 'V' or (s[i] == 'K' and s[i + 1] == 'K'):
		if i not in indices and i + 1 not in indices:
			cnt += 1
			break
print(cnt)


s = input()
k = s.split('VK')
m = len(k) - 1
for i in range(len(k)):
	if 'KK' in k[i] or 'VV' in k[i]:
		m += 1
		break
print(m)


def Main():
	s = input()
	ln = len(s)
	if ln == 1:
		print(0)
	elif ln == 2:
		if s[0] == 'K' and s[1] == 'V':
			print(0)
		else:
			print(1)
	else:
		cnt = s.count('VK')
		s = s.replace('VK', 'rr')
		s = ''.join(s)
		k = 0
		for i in range(len(s) - 1):
			if s[i] == 'K' and s[i + 1] == 'V':
				k = 0
			elif s[i] == 'V' and s[i + 1] == 'V' or (s[i] == 'K' and s[i + 1] == 'K'):
				k = 1
				break
		print(cnt + k)
Main()


word = input().strip()
ans = 0
word = word.split('VK')
ans = len(word) - 1
for item in word:
	if 'KK' in item or 'VV' in item:
		ans += 1
		break
print(ans)


s = input()
res = s.count('VK')
s = s.replace('VK', '?')
res += s.count('VV') > 0 or s.count('KK') > 0
print(res)


def vk(S):
	ans = 0
	for i in range(1, len(S)):
		if S[i - 1] == 'V' and S[i] == 'K':
			ans += 1
	return ans
S = list(input())
cur = vk(S)
for i in range(len(S)):
	tem = S[i]
	S[i] = 'V'
	cur = max(cur, vk(S))
	S[i] = tem
for i in range(len(S)):
	tem = S[i]
	S[i] = 'K'
	cur = max(cur, vk(S))
	S[i] = tem
print(cur)


s = input()
ans = s.count('VK')
s = s.replace('VK', 'ZZ')
if 'VV' in s or 'KK' in s:
	ans += 1
print(ans)


s = input()
m = s.count('VK')
for i in range(len(s)):
	s1 = s[:i]
	if s[i] == 'V':
		s1 += 'K'
	else:
		s1 += 'V'
	s1 += s[i + 1:]
	m1 = s1.count('VK')
	if m1 > m:
		m = m1
print(m)


s = input().strip()
s = s.replace('VK', '*')
cnt = sum(map(lambda x: x == '*', s))
if 'VV' in s or 'KK' in s:
	cnt += 1
print(cnt)


import sys
read = lambda : sys.stdin.readline().rstrip()
readi = lambda : int(sys.stdin.readline())
writeln = lambda x: sys.stdout.write(str(x) + '\n')
write = lambda x: sys.stdout.write(x)

def solve(s, ls):
	if ls == 1:
		return 0
	chk = [0] * ls
	t = [0] * ls
	cnt = 0
	for i in range(ls - 1):
		if s[i] == 'V' and s[i + 1] == 'K':
			chk[i] = 1
			cnt += 1
	for i in range(ls):
		if s[i] == 'V':
			if 0 <= i - 1 and s[i - 1] == 'V':
				t[i] += 1
			if i + 1 < ls and s[i + 1] == 'K':
				t[i] -= 1
		else:
			if 0 <= i - 1 and s[i - 1] == 'V':
				t[i] -= 1
			if i + 1 < ls and s[i + 1] == 'K':
				t[i] += 1
	mx = max(t)
	if mx <= 0:
		return cnt
	return cnt + max(t)
s = read()
ls = len(s)
writeln(solve(s, ls))