package no233; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.InputMismatchException; import java.util.NoSuchElementException; public class Main { static IO io = new IO(); public static void main(String[] args) { char[] p = "inabameguru".toCharArray(); Arrays.sort(p); int l = p.length; ArrayList lis1 = new ArrayList<>(); LOOP: do { if (!isBoin(p[l-1])) { continue; } boolean siin = false; for(int i=0;i lis2 = new ArrayList<>(); for(int i=0;i=0;--a) { if(p[a]p[a]) { char t = p[a]; p[a] = p[b]; p[b] = t; for(++a, b=p.length-1;a Integer.MAX_VALUE) { throw new NumberFormatException(); } return (int) nl; } public char nextChar() { if (!hasNext()) { throw new NoSuchElementException(); } return (char) readByte(); } public double nextDouble() { return Double.parseDouble(next());} public int[] nextIntArray(int n) { int[] a = new int[n]; for(int i=0;i