import java.util.Scanner; import java.util.Stack; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); StringBuilder sb = new StringBuilder(); Stack stack = new Stack(); int n = kb.nextInt(); int start = 1; for(int i = 0; i < n; i++) { int input = kb.nextInt(); while (start