#C2939. Daily Temperatures

    ID: 46310 Type: Default 1000ms 256MiB

Daily Temperatures

Daily Temperatures

Given a list of daily temperatures, for each day, determine the number of days one must wait until a warmer temperature occurs. If no future day has a higher temperature, output 0 for that day.

Formally, for each day \(i\) (0-indexed), find the smallest index \(j\) such that \(j > i\) and \(T[j] > T[i]\), and then let the answer for day \(i\) be \(j-i\). If no such \(j\) exists, the answer is 0.

inputFormat

The input is given via standard input (stdin) and consists of two lines. The first line contains an integer \(n\) which denotes the number of days. The second line contains \(n\) space-separated integers representing the daily temperatures.

outputFormat

Output a single line to standard output (stdout) with \(n\) space-separated integers where the \(i\)-th integer represents the number of days until a warmer temperature for the \(i\)-th day. If no warmer day exists, output 0 for that day.

## sample
8
73 74 75 71 69 72 76 73
1 1 4 2 1 1 0 0