Lining Up by Name
Time limit1sMemory limit256 MB
Check whether the given player names stand in increasing or decreasing dictionary order and print INCREASING, DECREASING, or NEITHER.
Problem
Coach Juhyuk likes to line his players up in name order, but he never says which order. Given the names of the players in the order they are standing, decide whether the names go up or down in dictionary order.
Two names are compared letter by letter from the front, and the first position where they differ decides the order. If one name matches the beginning of the other all the way to its end, the shorter name comes first.
Input
The first line contains the number of players . ()
Each of the next lines contains one player name, in the order the players are standing. A name is 2 to 12 uppercase letters. No two names are the same.
Output
Print INCREASING on one line if the names go up in dictionary order, or DECREASING if they go down. If neither holds, print NEITHER.