import java.util.*; import java.awt.geom.*; import java.io.*; class Main { static HashMap map = new HashMap(); public static void main(String[] args) { Scanner sc = new Scanner(System.in); String in = sc.next(); StringBuilder a = new StringBuilder(in); dfs(a); System.out.println(map.size()-1); } static void dfs(StringBuilder a) { ArrayDeque queue = new ArrayDeque(); queue.add(new StringBuilder(a)); while(!queue.isEmpty()) { a = queue.pollFirst(); String t = a.toString(); if(map.containsKey(a.toString())) continue; map.put(a.toString(), true); int tmp = a.length(); for(int i = 0; i < tmp; i++) { char b = a.charAt(i); for(int j = i+1; j < tmp; j++) { a = a.replace(i, i+1, String.valueOf(a.charAt(j))); a = a.replace(j, j+1, String.valueOf(b)); queue.add(new StringBuilder(a)); a = new StringBuilder(t); } } } } }