using System; using System.Collections.Generic; using System.Globalization; class Program { public static void Main(string[] args) { var s = Console.ReadLine(); var charactors = s.ToCharArray(); var head = 0; var tail = s.Length - 1; var sets = new HashSet(); Dfs(sets, charactors, head, tail, ""); Console.WriteLine(sets.Count); } private static void Dfs(HashSet sets, char[] charactors, int head, int tail, string current) { if (head == tail) { if (!sets.Contains(current)) { sets.Add(current); } return; } Dfs(sets, charactors, head+1, tail, current + charactors[head]); Dfs(sets, charactors, head, tail-1, current + charactors[tail]); } }