""" day_02_02.py """

# usage: python3 day_02_02.py < input

import sys


tally = {}

with sys.stdin as infile:
    while (op := infile.read(1)) and op != '\n':
        tally[op] = tally.get(op, 0) + 1

wps = ['r', 'v', 'b', 'g', 'y', 'o']

total = 0

carry = 6
for wp in wps:
    if tally.get(wp, 0) == 0:
        carry -= 1
    else:
        total += carry + (tally[wp] - 1) * 6
        carry = 5

print(total)
