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() s1.pop() s2.pop() a = set(itertools.permutations(s1)) b = set(itertools.permutations(s2)) print(1 if a == b else len(a) + len(b))