import java.io.PrintStream; import java.util.Arrays; import java.util.Scanner; /** * Solution to Tetris Generation. * * @author vanb */ public class tetrisgeneration_vanb { /** Input. */ private static Scanner sc; /** Output. */ private static PrintStream ps; /** The Constant tetrominos. */ private static final String tetrominos = "JLSZIOT"; /** Which tetrominos have been seen in a segment? */ private static boolean seen[] = new boolean[7]; /** The input string. */ private char s[]; /** * Test a segment for repeated tetrominos * * @param lo the lo index * @param hi the hi index - 1 * @return true, if no repeated tetrominos */ private boolean test( int lo, int hi ) { boolean ok = true; Arrays.fill( seen, false ); for( int i=lo; i0 ) { s = sc.next().toCharArray(); boolean ok = false; // We've got to test (up to) 7 different start points // We've got to be careful not to go off the end of the string for( int start=0; start