A9492. Suffix Structures
编程题
普及/提高-
知识点
题目描述
The first line contains a non-empty word $s$ . The second line contains a non-empty word $t$ . Words $s$ and $t$ are different. Each word consists only of lowercase English letters. Each word contains at most 100 letters.
输入格式
In the single line print the answer to the problem. Print "need tree" (without the quotes) if word $s$ cannot be transformed into word $t$ even with use of both suffix array and suffix automaton. Print "automaton" (without the quotes) if you need only the suffix automaton to solve the problem. Print "array" (without the quotes) if you need only the suffix array to solve the problem. Print "both" (without the quotes), if you need both data structures to solve the problem.
It's guaranteed that if you can solve the problem only with use of suffix array, then it is impossible to solve it only with use of suffix automaton. This is also true for suffix automaton.
It's guaranteed that if you can solve the problem only with use of suffix array, then it is impossible to solve it only with use of suffix automaton. This is also true for suffix automaton.
输出格式
In the third sample you can act like that: first transform "both" into "oth" by removing the first character using the suffix automaton and then make two swaps of the string using the suffix array and get "hot".
输入输出样例
输入 #1
automaton tomat
输出 #1
automaton
输入 #2
array arary
输出 #2
array
输入 #3
both hot
输出 #3
both
输入 #4
need tree
输出 #4
need tree
说明/提示
In the third sample you can act like that: first transform "both" into "oth" by removing the first character using the suffix automaton and then make two swaps of the string using the suffix array and get "hot".