Stock Span Stcks and Queues

import java.util.Stack;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
int N = sc.nextInt();
int[] arr = new int[N];
for(int i=0;i<N;i++) {
arr[i] = sc.nextInt();
}

	Stack<Integer> stack = new Stack<>();
	for(int j=0;j<arr.length;j++) {
		if(j==0) {
			stack.push(arr[0]);
			System.out.print(stack.size()+" ");
		}
		if(arr[j]>stack.peek()) {
			stack.push(arr[j]);
			System.out.print(stack.size()+" ");
		}
		if(arr[j]<stack.peek()) {
			
			System.out.print(1+" ");
		}
	}
	
	System.out.println("END");
}
}

// my two test cases are passing but two are wrong please suggest corrections if any

@Siddharth_sharma1808
The span Si of the stock’s price on a given day i is defined as the maximum number of consecutive days just before the given day, for which the price of the stock on the current day is less than or equal to its price on the given day.

your code is not running for this testcase.
For example, if an array of 7 days prices is given as {100, 80, 60, 70, 60, 75, 85}, then the span values for corresponding 7 days are {1, 1, 1, 2, 1, 4, 6}