CF1117E.Decypher the String

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the output. If you use some other programming language, consult its documentation. You may also refer to the guide on interactive problems: https://codeforces.com/blog/entry/45307.

You are given a string tt consisting of nn lowercase Latin letters. This string was cyphered as follows: initially, the jury had a string ss consisting of nn lowercase Latin letters. Then they applied a sequence of no more than nn (possibly zero) operations. ii -th operation is denoted by two integers aia_i and bib_i ( 1ai,bin1 \le a_i, b_i \le n ), and means swapping two elements of the string with indices aia_i and bib_i . All operations were done in the order they were placed in the sequence. For example, if ss is xyz and 22 following operations are performed: a1=1,b1=2a_1 = 1, b_1 = 2 ; a2=2,b2=3a_2 = 2, b_2 = 3 , then after the first operation the current string is yxz, and after the second operation the current string is yzx, so tt is yzx.

You are asked to restore the original string ss . Unfortunately, you have no information about the operations used in the algorithm (you don't even know if there were any operations in the sequence). But you may run the same sequence of operations on any string you want, provided that it contains only lowercase Latin letters and its length is nn , and get the resulting string after those operations.

Can you guess the original string ss asking the testing system to run the sequence of swaps no more than 33 times?

The string ss and the sequence of swaps are fixed in each test; the interactor doesn't try to adapt the test to your solution.

输入格式

Initially the testing system sends one string tt , consisting of lowercase Latin letters ( 1t=n1041 \le |t| = n \le 10^4 ).

输出格式

To give the answer, your program should print one line !! ss with a line break in the end. After that, it should flush the output and terminate gracefully.

Interaction

Before giving the answer, you may submit no more than 33 queries. To ask a query, print one line in the following format: ?? ss' , where ss' should be a string consisting of exaclty nn lowercase Latin letters. The line should be ended with a line break character. After submitting a query, flush the output and read the answer to your query — a string tt' consisting of nn lowercase Latin letters, which is the result of applying the sequence of swaps to string ss' . This string will be given on a separate line ended by a line break character.

If you submit an incorrect query (or ask more than 33 queries), the answer to it will be one string 0. After receiving such an answer, your program should terminate immediately — otherwise you may receive verdict "Runtime error", "Time limit exceeded" or some other verdict instead of "Wrong answer".

输入输出样例

  • 输入#1

    yzx
    aab
    baa
    aba

    输出#1

    ? baa
    ? aba
    ? aab
    ! xyz
    

说明/提示

In the sample, the testcase described in the statement is used. The participant asks the first query with string baa, which is transformed to aab. The second query contains string aba, which is transformed to baa. The third query contains string aab, which is transformed to aba. The participant can deduce that the initial string ss was xyz.

Note for hacking phase:

To submit a test in hacking phase, you should provide it in the following format:

The first line should contain the string ss you guess, consisting of n[1,10000]n \in [1, 10000] lowercase Latin letters.

The second line should contain kk ( 0kn0 \le k \le n ) — the number of swap operations in the sequence.

Then kk lines should follow, ii -th of them should denote ii -th operation with two integers aia_i and bib_i ( 1ai,bin1 \le a_i, b_i \le n ).

For example, the sample test would look like that:

xyz

2

1 2

2 3

首页