A space explorer's ship crashed on Mars! They send a series of SOS messages to Earth for help. 

Letters in some of the SOS messages are altered by cosmic radiation during transmission. Given the signal received by Earth as a string, $\boldsymbol{\mathrm{~S~}}$, determine how many letters of the SOS message have been changed by radiation.

Example  

$s=\text{'SOSTOT'}$  

The original message was SOSSOS.  Two of the message's characters were changed in transit.  

Function Description

Complete the marsExploration function in the editor below.  

marsExploration has the following parameter(s):

string s: the string as received on Earth  

Returns  

int: the number of letters changed during transmission  

Input Format

There is one line of input: a single string, $\boldsymbol{\mathrm{~S~}}$. 

Constraints

$1\leq\ \text{length of}\ s\leq99$
$\textbf{length of}~s~\textbf{modulo}~~3=0$
$\boldsymbol{\mathrm{~S~}}$ will contain only uppercase English letters, ascii[A-Z].

Sample Input 0
SOSSPSSQSSOR

Sample Output 0
3

Explanation 0

$\boldsymbol{\mathrm{~S~}}$ = SOSSPSSQSSOR, and signal length $\textbf{|s|}=\textbf{12}$. They sent $4$ SOS messages (i.e.: $12/3=4$).

Expected signal: SOSSOSSOSSOS
Recieved signal: SOSSPSSQSSOR
Difference:          X  X   X

Sample Input 1
SOSSOT

Sample Output 1
1

Explanation 1

$\boldsymbol{\mathrm{~S~}}$ = SOSSOT, and signal length $|s|=6$. They sent $2$ SOS messages (i.e.: $6/3=2$).

Expected Signal: SOSSOS     
Received Signal: SOSSOT
Difference:           X

Sample Input 2
SOSSOSSOS

Sample Output 2
0

Explanation 2

Since no character is altered, return 0.

Source: hackerrank | Difficulty: EASY
Tags: String algorithms


Solutions:
s = input()
n = 'SOS' * (len(s) // 3)
cnt = 0
for i in range(len(s)):
	if s[i] != n[i]:
		cnt += 1
print(cnt)


import sys
S = input().strip()
res = 0
for i in range(len(S)):
	cl = 'S'
	if i % 3 == 1:
		cl = 'O'
	if S[i] != cl:
		res += 1
print(res)


s = input().strip()
n = 0
for (i, c) in enumerate(s):
	if i % 3 == 1:
		if c != 'O':
			n += 1
	elif c != 'S':
		n += 1
print(n)


def main():
	s = input()
	ans = 0
	t = 'SOS' * (len(s) // 3)
	for i in range(len(s)):
		ans += s[i] != t[i]
	print(ans)
main()


import sys
s = input()
i = 0
ans = 0
while i < len(s):
	if s[i] != 'S':
		ans += 1
	if s[i + 1] != 'O':
		ans += 1
	if s[i + 2] != 'S':
		ans += 1
	i += 3
print(ans)


import sys
S = input().strip()
changed = 0
for i in range(len(S)):
	if i % 3 == 1:
		if S[i] != 'O':
			changed += 1
	elif S[i] != 'S':
		changed += 1
print(changed)


import sys
S = input().strip()
print(sum([c != ('O' if i % 3 == 1 else 'S') for (i, c) in enumerate(S)]))


import sys
S = input().strip()
O = 'SOS' * (len(S) // 3)
print(sum((1 for i in range(len(S)) if S[i] != O[i])))


s = input()
count = 0
for (i, ch) in enumerate(s):
	if i % 3 == 1:
		if ch != 'O':
			count += 1
	elif ch != 'S':
		count += 1
print(count)


import sys
count = 0
S = input().strip()
for i in range(len(S)):
	if i % 3 == 1:
		if S[i] != 'O':
			count += 1
	elif S[i] != 'S':
		count += 1
print(count)


check = 'SOS'
string = input()
i = 0
k = 0
cnt = 0
while i < len(string):
	if k == 3:
		k = 0
	if string[i] != check[k]:
		cnt += 1
	k += 1
	i += 1
print(cnt)


s = input()
l = len(s)
x = l // 3
d = 'SOS' * x
c = 0
for i in range(l):
	if s[i] != d[i]:
		c += 1
print(c)


s = input()
ans = 0
for i in range(len(s)):
	if s[i] != 'SOS'[i % 3]:
		ans += 1
print(ans)


import sys
S = input().strip()
orig = 'SOS' * (len(S) // 3)
print(sum((c != d for (c, d) in zip(S, orig))))


S = input().strip()
k = len(S) // 3
P = 'SOS' * k
total = 0
for i in zip(S, P):
	if i[0] != i[1]:
		total += 1
print(total)


import sys
S = input().strip()
n = len(S)
cnt = 0
for i in range(0, n, 3):
	if S[i] != 'S':
		cnt += 1
	if S[i + 1] != 'O':
		cnt += 1
	if S[i + 2] != 'S':
		cnt += 1
print(cnt)


import sys
S = input().strip()
num_errors = 0
for (i, char) in enumerate(S):
	if i % 3 == 1:
		if char != 'O':
			num_errors += 1
	elif char != 'S':
		num_errors += 1
print(num_errors)


import sys
MSG = 'SOS'
S = input().strip()
count = 0
for x in range(0, len(S), len(MSG)):
	for y in range(len(MSG)):
		if S[x + y] != MSG[y]:
			count += 1
print(count)


import sys
S = input().strip()
ctr = 0
for (i, letter) in enumerate(S):
	if i % 3 == 0 and letter != 'S':
		ctr += 1
	elif i % 3 == 1 and letter != 'O':
		ctr += 1
	if i % 3 == 2 and letter != 'S':
		ctr += 1
print(ctr)


import sys
S = input().strip()
n_mistakes = 0
for (n, letter) in enumerate(S):
	if n % 3 != 1:
		if letter != 'S':
			n_mistakes += 1
	elif letter != 'O':
		n_mistakes += 1
print(n_mistakes)


import sys
S = input().strip()
l = len(S)
count = 0
for i in range(l):
	if i % 3 == 0 or i % 3 == 2:
		if S[i] != 'S':
			count += 1
	elif S[i] != 'O':
		count += 1
print(count)


import sys
S = input().strip()
ln = len(S) // 3
M = 'SOS'
x = 0
for i in range(ln):
	for j in range(3):
		if S[3 * i + j] != M[j]:
			x += 1
print(x)


import sys
S = input().strip()
out = ''
for (i, c) in enumerate(S):
	if i % 3 == 0 and c != 'S':
		out += c
	elif i % 3 == 1 and c != 'O':
		out += c
	elif i % 3 == 2 and c != 'S':
		out += c
print(out, file=sys.stderr)
print(len(out))


import sys
S = input().strip()
sam = 'SOS' * int(len(S) / 3)
count = 0
for (let, y) in zip(S, sam):
	if let != y:
		count += 1
print(count)


s = input()
ans = 0
for i in range(len(s) // 3):
	if s[3 * i] != 'S':
		ans += 1
	if s[3 * i + 1] != 'O':
		ans += 1
	if s[3 * i + 2] != 'S':
		ans += 1
print(ans)


S = input()
l = len(S)
x = 0
y = 0
while x < l:
	if x % 3 == 0 or x % 3 == 2:
		if S[x] != 'S':
			y += 1
	elif S[x] != 'O':
		y += 1
	x += 1
print(y)


import sys
S = input().strip()
sos = 'SOS'
counter = 0
for (index, letter) in enumerate(S):
	if letter != sos[index % 3]:
		counter += 1
print(counter)


import sys

def AlteredCharacters(S):
	length = len(S)
	count = 0
	for i in range(0, length, 3):
		if S[i] != 'S':
			count = count + 1
		if S[i + 1] != 'O':
			count = count + 1
		if S[i + 2] != 'S':
			count = count + 1
	return count
S = input().strip()
print(AlteredCharacters(S))


import sys
s = input().strip()
c = 0
for i in range(len(s)):
	if i % 3 == 0 or i % 3 == 2:
		if s[i] != 'S':
			c += 1
	if i % 3 == 1:
		if s[i] != 'O':
			c += 1
print(c)


import sys

def hamming(s, t):
	count = 0
	for i in range(len(s)):
		if s[i] != t[i]:
			count += 1
	return count
S = input().strip()
triples = len(S) // 3
expected = 'SOS' * triples
print(hamming(S, expected))


s = input()
cnt = 0
for i in range(len(s)):
	if i % 3 == 1:
		if s[i] != 'O':
			cnt += 1
	elif s[i] != 'S':
		cnt += 1
print(cnt)


import sys
S = input().strip()
count = 0
for i in range(0, len(S), 3):
	if S[i] is not 'S':
		count += 1
	if S[i + 1] is not 'O':
		count += 1
	if S[i + 2] is not 'S':
		count += 1
print(str(count))


import sys
S = input().strip()
ans = 0
for i in range(0, len(S), 3):
	if S[i] != 'S':
		ans = ans + 1
	if S[i + 1] != 'O':
		ans = ans + 1
	if S[i + 2] != 'S':
		ans = ans + 1
print(ans)


mensaje = input().strip()
errores = 0
for i in range(int(len(mensaje) / 3)):
	iBase = i * 3
	errores += sum(map(int, [mensaje[iBase] != 'S', mensaje[iBase + 1] != 'O', mensaje[iBase + 2] != 'S']))
print(errores)


import sys
S = input().strip()
(c, i) = (0, 0)
while i < len(S):
	if S[i] != 'S':
		c = c + 1
	if S[i + 1] != 'O':
		c = c + 1
	if S[i + 2] != 'S':
		c = c + 1
	i = i + 3
print(c)


import sys
S = input().strip()
cnt = len([c for (i, c) in enumerate(S) if c != 'SOS'[i % 3]])
print(cnt)


import sys
S = input().strip()
count = 0
for i in range(len(S)):
	if S[i] != 'SOS'[i % 3]:
		count += 1
print(count)


import sys
S = input().strip()
count = 0
for i in range(len(S)):
	if i % 3 == 0 or i % 3 == 2:
		if S[i] != 'S':
			count += 1
	elif i % 3 == 1 and S[i] != 'O':
		count += 1
print(count)


import sys
S = input().strip()
n = 0
for i in range(0, len(S), 3):
	if S[i] != 'S':
		n += 1
	if S[i + 1] != 'O':
		n += 1
	if S[i + 2] != 'S':
		n += 1
print(n)


S = input()
n = len(S)
counter = 0
for i in range(0, n, 3):
	if S[i] != 'S':
		counter += 1
	if S[i + 1] != 'O':
		counter += 1
	if S[i + 2] != 'S':
		counter += 1
print(counter)


import sys
mes = 'SOS'
t = 0
S = input().strip()
for i in range(len(S)):
	if S[i] != mes[i % 3]:
		t = t + 1
print(t)


import sys
S = input().strip()
n = 0
for i in range(0, len(S), 3):
	if S[i] != 'S':
		n += 1
	if S[i + 1] != 'O':
		n += 1
	if S[i + 2] != 'S':
		n += 1
print(n)


import sys
import re
S = input().strip()
res = re.findall('(...)', S)
t = 0
for r in res:
	if r[0] != 'S':
		t += 1
	if r[1] != 'O':
		t += 1
	if r[2] != 'S':
		t += 1
print(t)


import sys

def main():
	S = input().strip()
	origMesg = 'SOS' * (len(S) // 3)
	count = 0
	for i in range(len(S)):
		if origMesg[i] != S[i]:
			count = count + 1
	print(count)
main()


import sys
is_Debug = False
changed_Letters_Counter = 0
S = input().strip()
sos_List = [(S[indx], S[indx + 1], S[indx + 2]) for indx in range(0, len(S) - 2, 3)]
if is_Debug:
	print('sos_List: {}'.format(sos_List))
for (s1, o, s2) in sos_List:
	if s1 != 'S':
		changed_Letters_Counter += 1
	if o != 'O':
		changed_Letters_Counter += 1
	if s2 != 'S':
		changed_Letters_Counter += 1
print('{}'.format(changed_Letters_Counter))


import sys
S = input().strip()
L = len(S)
c = 0
correct = ''
while c < L:
	correct += 'SOS'
	c += 3
diff = 0
for i in range(L):
	if S[i] != correct[i]:
		diff += 1
print(diff)


import sys
S = input().strip()
sum = 0
nu = len(S) // 3
a = [0, 0]
for i in range(len(S)):
	if i % 3 == 0 or i % 3 == 2:
		if S[i] != 'S':
			sum += 1
	elif i % 3 == 1:
		if S[i] != 'O':
			sum += 1
print(sum)


import sys
S = input().strip()
j = 0
errors = 0
for i in range(int(len(S) / 3)):
	SOS = S[j:j + 3]
	if SOS[0] != 'S':
		errors += 1
	if SOS[1] != 'O':
		errors += 1
	if SOS[2] != 'S':
		errors += 1
	j += 3
print(errors)


S = input().strip()
ans = 0
s1 = S[0:len(S):3]
s1_c = s1.count('S')
ans += len(s1) - s1_c
o = S[1:len(S):3]
o_c = o.count('O')
ans += len(s1) - o_c
s2 = S[2:len(S):3]
s2_c = s2.count('S')
ans += len(s1) - s2_c
print(ans)


import sys
S = input().strip()
n = len(S) // 3
correct = 'SOS' * n
print(sum((x[0] != x[1] for x in zip(S, correct))))


s = input()
n = 0
for i in range(len(s)):
	if i % 3 == 1:
		if s[i] != 'O':
			n += 1
	elif s[i] != 'S':
		n += 1
print(n)


S = input().strip()
n = len(S)
count = 0
for i in range(n // 3):
	if S[i * 3] != 'S':
		count += 1
	if S[i * 3 + 1] != 'O':
		count += 1
	if S[i * 3 + 2] != 'S':
		count += 1
print(count)


import sys
S = input().strip()
count = 0
for i in range(0, len(S), 3):
	if S[i] != 'S':
		count += 1
	if S[i + 1] != 'O':
		count += 1
	if S[i + 2] != 'S':
		count += 1
print(count)


import sys
S = input().strip()
sum = 0
for i in range(0, len(S) // 3):
	if S[3 * i] != 'S':
		sum += 1
	if S[3 * i + 1] != 'O':
		sum += 1
	if S[3 * i + 2] != 'S':
		sum += 1
print(sum)


import sys
S = input().strip()
count = 0
count2 = 0
while count < len(S):
	if S[count] != 'S':
		count2 = count2 + 1
	count = count + 1
	if S[count] != 'O':
		count2 = count2 + 1
	count = count + 1
	if S[count] != 'S':
		count2 = count2 + 1
	count = count + 1
print(count2)


import sys
S = input().strip()
sos_string = ['S', 'O', 'S']
sum = 0
for i in range(len(S)):
	if S[i] != sos_string[i % 3]:
		sum += 1
print(sum)


import sys
S = input().strip()
n = len(S) // 3
patron = 'SOS' * n
print(len([1 for i in range(len(S)) if S[i] != patron[i]]))


print(sum((1 for (i, letter) in enumerate(input().strip()) if ord(letter) - ord('SOS'[i % 3]) != 0)))


import sys
input_word = input().strip()
score = 0
for idx in range(0, len(input_word), 3):
	word = input_word[idx:idx + 3]
	if word == 'SOS':
		continue
	else:
		if word[0] != 'S':
			score += 1
		if word[1] != 'O':
			score += 1
		if word[2] != 'S':
			score += 1
print(score)


import sys
sos = 'SOS'

def count_diff(s):
	diff_count = 0
	if s[0] != 'S':
		diff_count += 1
	if s[1] != 'O':
		diff_count += 1
	if s[2] != 'S':
		diff_count += 1
	return diff_count
S = input().strip()
n = len(S)
count = 0
sos = 'SOS'
splitted = []
i = 0
while i < n:
	splitted.append(S[i:i + 3])
	i += 3
for i in range(len(splitted)):
	count += count_diff(splitted[i])
print(count)


import sys
S = input().strip()
nb = len(S) // 3
em = 'SOS' * nb
compteur = 0
for i in range(len(S)):
	if em[i] != S[i]:
		compteur += 1
print(compteur)


import sys
S = input().strip()
(i, c) = (0, 0)
for s in S:
	if s != ('O' if i % 3 == 1 else 'S'):
		c += 1
	i += 1
print(c)


import sys
s = input().strip()
n = len(s) / 3
i = 0
count = 0
while i < len(s):
	if ord(s[i]) != 83:
		count += 1
	if ord(s[i + 1]) != 79:
		count += 1
	if ord(s[i + 2]) != 83:
		count += 1
	i += 3
print(count)


S = input()
ans = 0
for i in range(len(S)):
	if i % 3 == 1 and S[i] != 'O':
		ans += 1
	if i % 3 != 1 and S[i] != 'S':
		ans += 1
print(ans)


import sys

def createSOSLetterGenerator():
	word = 'SOS'
	index = 0
	while True:
		yield word[index]
		index += 1
		if index > 2:
			index = 0

def main():
	number_of_incorrect_letters = 0
	sequential_string = input().strip()
	sos_letter_generator = createSOSLetterGenerator()
	for index in range(0, len(sequential_string)):
		expected_letter = next(sos_letter_generator)
		if expected_letter != sequential_string[index]:
			number_of_incorrect_letters += 1
	print(number_of_incorrect_letters)
main()


inp = input()
fixed = ['S', 'O', 'S']
count = 0
for i in range(0, len(inp)):
	if not inp[i] == fixed[int(i % 3)]:
		count += 1
print(count)


import sys

def count_noise(S):
	count = 0
	for i in range(len(S)):
		if (i % 3 == 0 or i % 3 == 2) and (not S[i] == 'S'):
			count += 1
		elif i % 3 == 1 and (not S[i] == 'O'):
			count += 1
	return count
S = input().strip()
print(count_noise(S))


import sys
S = input().strip()
sol = 0
state = 0
for c in S:
	if state == 0:
		if c != 'S':
			sol += 1
		state = 1
	elif state == 1:
		if c != 'O':
			sol += 1
		state = 2
	else:
		if c != 'S':
			sol += 1
		state = 0
print(sol)


import sys
S = input().strip()
n = len(S)
k = 0
for i in range(n):
	if i % 3 == 1 and S[i] != 'O' or ((i % 3 == 2 or i % 3 == 0) and S[i] != 'S'):
		k += 1
print(k)


import sys

def nb_diff(s1, s2):
	d = [1 if a != b else 0 for (a, b) in zip(s1, s2)]
	return sum(d)
S = input().strip()
occurences = len(S) // 3
base = 'SOS' * occurences
print(nb_diff(base, S))


x = [c for c in input()]
x1 = x[0::3]
x2 = x[1::3]
x3 = x[2::3]
changed = 0
for letter1 in x1:
	if letter1 != 'S':
		changed += 1
for letter2 in x2:
	if letter2 != 'O':
		changed += 1
for letter3 in x3:
	if letter3 != 'S':
		changed += 1
print(changed)


import sys
S = input().strip()
c = len(S)
tot = 0
p = 0
for a in S:
	if p == 0:
		p = 1
		ch = 'S'
	elif p == 1:
		p = 2
		ch = 'O'
	elif p == 2:
		p = 0
		ch = 'S'
	if a != ch:
		tot += 1
print(tot)


S = input().strip()
wrong = 0
for s in range(len(S)):
	m = s % 3
	if m == 0 or m == 2:
		expected = 'S'
	else:
		expected = 'O'
	if S[s] != expected:
		wrong += 1
print(wrong)


S = input()
n = len(S) // 3
res = 0
C = 'SOS'
for i in range(n):
	for j in range(len(C)):
		if S[i * len(C) + j] != C[j]:
			res += 1
print(res)


import sys
s = input().strip()
l = len(s)
c = l // 3
a = 'SOS' * c
s = list(s)
a = list(a)
err = 0
for i in range(l):
	if s[i] != a[i]:
		err = err + 1
print(err)


import sys
S = input().strip()
expected = ['S', 'O', 'S']
count = 0
for (index, letter) in enumerate(S):
	if letter != expected[index % 3]:
		count += 1
print(count)


import sys
S = input().strip()
messages = 'SOS'
count = 0
for i in range(len(S)):
	if S[i] != messages[i % 3]:
		count += 1
print(count)


s = input().strip()
l = len(s)
count = 0
for i in range(l):
	if i % 3 == 0:
		if s[i] != 'S':
			count = count + 1
	elif i % 3 == 1:
		if s[i] != 'O':
			count = count + 1
	elif s[i] != 'S':
		count = count + 1
print(count)


import sys
S = input().strip()
sos = 'SOS'
counter = 0
for i in range(0, len(S), len(sos)):
	for j in range(len(sos)):
		if S[i + j] != sos[j]:
			counter += 1
print(counter)


import sys
S = input().strip()
sum = 0
for (i, c) in enumerate(S):
	if i % 3 == 0 and (not c is 'S') or (i % 3 == 1 and (not c is 'O')) or (i % 3 == 2 and (not c is 'S')):
		sum += 1
print(sum)


import sys
S = input().strip()
total = 0
for i in range(int(len(S) / 3)):
	x = i * 3
	total += S[x] != 'S'
	total += S[x + 1] != 'O'
	total += S[x + 2] != 'S'
print(total)


S = input()
count = 0
for i in range(0, len(S) - 2, 3):
	if S[i:i + 3] != 'SOS':
		if S[i] != 'S':
			count += 1
		if S[i + 1] != 'O':
			count += 1
		if S[i + 2] != 'S':
			count += 1
print(count)


import sys

def count_altered(inp: str):
	i = 0
	alter_cnt = 0
	inp_len = len(inp)
	step = 3
	while i < inp_len:
		if inp[i] != 'S':
			alter_cnt += 1
		if inp[i + 1] != 'O':
			alter_cnt += 1
		if inp[i + 2] != 'S':
			alter_cnt += 1
		i += step
	return alter_cnt
S = input().strip()
print(count_altered(S))


import sys
S = input().strip()
SOS = 'SOS'
num = len(S)
SOS = SOS * int(num / 3)
diff = 0
for x in range(num):
	if S[x] != SOS[x]:
		diff += 1
print(diff)


import sys
S = input().strip()
n = 3
L = [S[i:i + n] for i in range(0, len(S), n)]
N = len(L)
total = 0
for x in L:
	if x[0] != 'S':
		total += 1
	if x[1] != 'O':
		total += 1
	if x[2] != 'S':
		total += 1
print(total)


import sys
S = input().strip()
sArr = []
for ch in S:
	sArr.append(ch)
count = 0
for i in range(0, len(sArr), 3):
	if sArr[i] != 'S':
		count += 1
	if sArr[i + 1] != 'O':
		count += 1
	if sArr[i + 2] != 'S':
		count += 1
print(count)


import sys
S = input().strip()
num = 1
count = 0
for i in S:
	if num == 1:
		if i != 'S':
			count += 1
		num += 1
	elif num == 2:
		if i != 'O':
			count += 1
		num += 1
	elif num == 3:
		if i != 'S':
			count += 1
		num = 1
print(count)


import sys
S = input().strip()
real = ['S', 'O', 'S'] * int(len(S) / 3)
ans = 0
for i in range(0, len(S)):
	if S[i] != real[i]:
		ans += 1
print(ans)


def reduce(xs):
	v = 0
	if xs[0] != 'S':
		v += 1
	if xs[1] != 'O':
		v += 1
	if xs[2] != 'S':
		v += 1
	return v
xs = list(input().strip())
print(sum(list(map(reduce, [xs[i:i + 3] for i in range(0, len(xs), 3)]))))


import sys
S = input().strip()
counter = 0
model = 'SOS'
for i in range(0, len(S), 3):
	if S[i:i + 3] != model:
		for j in range(0, 3):
			if S[i + j] != model[j]:
				counter += 1
print(counter)


import sys
from itertools import zip_longest
S = input().strip()

def grouper(iterable, n, fillvalue=None):
	args = [iter(iterable)] * n
	return zip_longest(*args, fillvalue=fillvalue)
soss = [''.join(i) for i in grouper(S, 3)]
brokens = [s for s in soss if s != 'SOS']
count = 0
for b in brokens:
	if b[0] != 'S':
		count += 1
	if b[1] != 'O':
		count += 1
	if b[2] != 'S':
		count += 1
print(count)


import sys
S = input().strip()
count = 0
i = 0
while i < len(S):
	if S[i] != 'S':
		count += 1
	i += 1
	if S[i] != 'O':
		count += 1
	i += 1
	if S[i] != 'S':
		count += 1
	i += 1
print(count)


import sys
s = input().strip()
changed = []
for i in range(len(s)):
	if (i + 1) % 3 == 2:
		if s[i] != 'O':
			changed.append(s[i])
	elif s[i] != 'S':
		changed.append(s[i])
print(len(changed))


l = list(input())
c = 0
t = 0
for i in range(len(l) // 3):
	s = l[i + c:i + c + 3]
	if s[0] != 'S':
		t += 1
	if s[1] != 'O':
		t += 1
	if s[2] != 'S':
		t += 1
	c += 2
print(t)


import sys
S = input().strip()
cnt = 0
for i in range(0, len(S), 3):
	for j in range(3):
		if S[i + j] != 'SOS'[j]:
			cnt += 1
print(cnt)


import sys
s = input().strip().lower()
errors = 0
for i in range(len(s)):
	if s[i] != 'sos'[i % 3]:
		errors += 1
print(errors)


import sys
S = input().strip()
count = 0
for i in range(len(S)):
	if i % 3 == 1:
		if S[i] != 'O':
			count += 1
	elif S[i] != 'S':
		count += 1
print(count)


def main():
	s = input()
	n = len(s)
	count = 0
	for i in range(0, n):
		if i % 3 == 1 and s[i] != 'O':
			count = count + 1
		elif i % 3 == 2 and s[i] != 'S':
			count = count + 1
		elif i % 3 == 0 and s[i] != 'S':
			count = count + 1
	print(count)
main()


import sys
S = input().strip()
i = 0
j = 1
k = 2
bad_letter_count = 0
while k < len(S):
	if S[i] != 'S':
		bad_letter_count += 1
	if S[j] != 'O':
		bad_letter_count += 1
	if S[k] != 'S':
		bad_letter_count += 1
	i += 3
	j += 3
	k += 3
print(bad_letter_count)


import sys

def letters_altered(s):
	count = 0
	for i in range(len(s) // 3):
		if s[i * 3] == 'S':
			pass
		else:
			count += 1
		if s[i * 3 + 1] == 'O':
			pass
		else:
			count += 1
		if s[i * 3 + 2] == 'S':
			pass
		else:
			count += 1
	return count
s = input().strip()
print(letters_altered(s))