#K8726. Sorted or Unsorted List
Sorted or Unsorted List
Sorted or Unsorted List
Given a list of ( n ) integers, determine whether the list is sorted in non-decreasing order. In other words, for every index ( i ) where ( 1 \leq i < n ), the condition ( a_i \leq a_{i+1} ) must hold. If the list satisfies this condition, output "Sorted"; otherwise, print "Unsorted". This problem tests your ability to process input data and implement basic array traversal.
inputFormat
The input is read from standard input (stdin) and consists of two lines. The first line contains a single integer ( n ) — the number of elements in the list. The second line contains ( n ) integers separated by spaces.
outputFormat
Output a single line to standard output (stdout) containing either "Sorted" if the list is in non-decreasing order or "Unsorted" otherwise.## sample
4
2 3 5 7
Sorted