import sys #sys.setrecursionlimit(n) import heapq import re import bisect import random import math import itertools from collections import defaultdict, deque from copy import deepcopy s = str(input()) s1 = list(s) s2 = list(s) s2.reverse() a = s1.pop() b = s2.pop() d = defaultdict(dict) for ss in itertools.permutations(s1): d[("".join(ss) + a)] = 1 for ss in itertools.permutations(s2): d[("".join(ss) + b)] = 1 print(len(d))