import java.util.*; /** * Count the spaces and tabs on each line and keep track of depth. * We get n equations of the form: * depth[i] * indent = spaces[i] + tabs[i] * tabWidth * Try solving each pair of them for tabWidth and indent. If any pair * is inconsistent return -1. If all pairs have infinite solutions, then * try tabWidth=1. If any pair has a unique non-integer or non-positive * solution, then return -1. After finding a solution for tabWidth, indent * for one pair of equations, check the solution against all other solutions. * * @author Finn Lidbetter */ public class space_alignment_finn { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); int[] depth = new int[n]; int[] spaces = new int[n]; int[] tabs = new int[n]; int currDepth = -1; for (int i=0; i 0) { int a = spaces[i]; int b = tabs[i]; int d = depth[i]; indent = (a + b * tabWidth) / d; break; } } } for (int i=0; i