import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class C { public static void main(String[] args) throws IOException { MyScanner sc = new MyScanner(System.in); String p = sc.next(); int[] ds = new int[20000]; for(int i=0; i