CF448B.Suffix Structures

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The first line contains a non-empty word ss . The second line contains a non-empty word tt . Words ss and tt 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 ss cannot be transformed into word tt 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.

输出格式

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".

首页