from itertools import permutations from sys import stdin, stdout input = lambda: stdin.readline().rstrip() write = stdout.write def main(): S = input() strings = set() for s in permutations(S[:-1]): strings.add(S[-1] + ''.join(s)) for s in permutations(S[1:]): strings.add(S[0] + ''.join(s)) print(len(strings)) main()