#P2412. 查单词
查单词
Description
HansBug found a word list in an English book, containing words (each word consists of uppercase and lowercase letters). He wants to find the lexicographically largest word within a contiguous segment.
Input Format
The first line contains two positive integers and , representing the number of words and the number of queries.
The next lines each contain a string consisting only of uppercase and lowercase letters, with length at most , representing a word. Words are case-insensitive.
The next lines each contain two integers and , asking for the lexicographically largest word from the -th to the -th word. If two words are the same in lexicographical order when ignoring case, output the one that appears later.
Output Format
Output lines, each containing a string, corresponding to the results of the queries in order.
5 5
absi
hansbug
lzn
kkk
yyy
1 5
1 1
1 2
2 3
4 4
yyy
absi
hansbug
lzn
kkk
Hint
Sample Explanation
First operation: find the lexicographically largest in , which is .
Second operation: find the lexicographically largest in , which is .
Third operation: find the lexicographically largest in , which is .
Fourth operation: find the lexicographically largest in , which is .
Fifth operation: find the lexicographically largest in , which is .
Constraints

Translated by ChatGPT 5
京公网安备 11011102002149号