import java.io.*; import java.util.*; public class Main { private void run() { String S = read(); HashSet set = new HashSet(); set.add(S); Stack stk = new Stack(); stk.push(S); while (!stk.isEmpty()) { String t = stk.pop(); for (int i = 0; i < t.length() - 1; i++) { char[] uu = t.toCharArray(); char tmp = uu[i]; uu[i] = uu[i + 1]; uu[i + 1] = tmp; String u = new String(uu); if (!set.contains(u)) { set.add(u); stk.push(u); } } } sysout.println(set.size() - 1); } public static void main(String[] args) { new Main().run(); } // flush automatically iff you call `println` or `printf` or `format`. PrintWriter sysout = new PrintWriter(System.out, true); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer buffer = null; String readLine() { buffer = null; try { return in.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } String read() { if (buffer == null || !buffer.hasMoreTokens()) { buffer = new StringTokenizer(readLine()); } return buffer.nextToken(); } int readInt() { return Integer.parseInt(read()); } long readLong() { return Long.parseLong(read()); } double readDouble() { return Double.parseDouble(read()); } }