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(); dfs(new StringBuilder(in)); System.out.println(map.size()-1); } static void dfs(StringBuilder a) { if(map.containsKey(a.toString())) return; map.put(a.toString(), true); for(int i = 0; i < a.length(); i++) { for(int j = i+1; j < a.length(); j++) { char b = a.charAt(i); a = a.replace(i, i+1, String.valueOf(a.charAt(j))); a = a.replace(j, j+1, String.valueOf(b)); dfs(a); a = a.replace(j, j+1, String.valueOf(a.charAt(i))); a = a.replace(i, i+1, String.valueOf(b)); } } } }