#K596. Daily Temperatures

    ID: 30900 Type: Default 1000ms 256MiB

Daily Temperatures

Daily Temperatures

You are given a list of daily temperatures. For each day, compute the number of days you have to wait until a warmer temperature occurs. If there is no future day for which this is possible, put 0 for that day.

The problem can be formally described as follows: Given an array (T) of integers representing daily temperatures, return an array (answer) such that (answer[i]) is the number of days until a warmer temperature for day (i). If such a day does not exist, then (answer[i] = 0).

For example, given (T = [73, 74, 75, 71, 69, 72, 76]), the result should be ([1, 1, 4, 2, 1, 1, 0]).

inputFormat

Input is read from standard input (stdin). The input consists of two lines:

  1. The first line contains an integer \(n\) representing the number of days.
  2. The second line contains \(n\) space-separated integers representing the temperatures on each day.

outputFormat

Output to standard output (stdout) a single line containing \(n\) space-separated integers. The \(i\)-th integer represents the number of days required for a warmer temperature after day \(i\). If there is no future day with a warmer temperature, output 0 for that day.

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

</p>