Aho

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

All characters appearing in this and following statements are fictitious. Any resemblance to real persons, living or dead, is purely coincidental.

This is an interactive problem.

Alfred and Margaret always play some weird string-guessing games when they spend a charming evening in the coffee shop "Donald's place".

This time, the rules are the following:

  • The first player writes down a string SS of a predefined length NN. The first player also has a string TT that is initially empty. Both strings contain only lowercase English letters.
  • The second player can not see these strings during the whole game. However, the second player is allowed to ask whether the characters on any pair of positions in any of the strings are equal. For example, a question can look like the following: "Is the second character of string SS equal to the fifth character of string TT?" Note that it is also allowed to compare two positions of the same string using this question.
  • The game is played in MM rounds. At the start of each round, the first player adds a single character to the end of string TT.
  • When a new character is added, the second player can ask no more than five questions. After that, the second player must say how many substrings of string TT are equal to string SS.

Margaret quickly noticed that Alfred always succeeds as the second player. She suspects there is a strategy that allows the second player to win regardless of what are the strings SS and TT. Could you figure it out?