What's is wrong in this code?

import java.util.*;
public class Main {

public static void main(String args[]) throws Exception {
	// Your Code Here
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int span = 0,t;
	Stack<Integer> stack = new Stack<>();
	String out = "";
	stack.push(-1);
	for (int i = 0; i < n; i++) {
		t = sc.nextInt();
		if(stack.peek() < t) {
			span++;
		}
		else {
			span = 1;
		}
		out += span + " ";
		stack.push(t);
	}
	
	System.out.println(out+"END");	
}

}