s = list(map(lambda x: ord(x)-97, input())) dir = [[-1, 0], [1, 0], [0, -1]] flg = 1 now = [0, 0] st = set([tuple(now)]) for c in s: x, y = dir[c] now[0] += x now[1] += y st.add(tuple(now)) if dir[c] == [-1, 0]: if flg: for i in range(3): if dir[i] == [-1, 0]: dir[i] = [1, 0] if dir[i] == [1, 0]: dir[i] = [0, 1] if dir[i] == [0, -1]: dir[i] = [0, 1] else: for i in range(3): if dir[i] == [-1, 0]: dir[i] = [1, 0] if dir[i] == [1, 0]: dir[i] = [0, -1] if dir[i] == [0, 1]: dir[i] = [-1, 0] elif dir[c] == [1, 0]: if flg: for i in range(3): if dir[i] == [1, 0]: dir[i] = [-1, 0] if dir[i] == [-1, 0]: dir[i] = [0, 1] if dir[i] == [0, -1]: dir[i] = [1, 0] else: for i in range(3): if dir[i] == [1, 0]: dir[i] = [-1, 0] if dir[i] == [-1, 0]: dir[i] = [0, -1] if dir[i] == [0, 1]: dir[i] = [1, 0] elif dir[c] == [0, -1]: dir[c] = [0, 1] elif dir[c] == [0, 1]: dir[c] = [0, -1] flg ^= 1 print(len(st))