求助,英语翻译,急!!!!!!!

来源:百度知道 编辑:UC知道 时间:2024/05/16 01:46:14
142. Keyword

Time Limit: 2 sec, Memory Limit: 16 MB

Kevin has invented a new algorithm to crypt and decrypt messages, which he thinks is unbeatable. The algorithm uses a very large key-string, out of which a keyword is found out after applying the algorithm. Then, based on this keyword, the message is easily crypted or decrypted. So, if one would try to decrypt some messages crypted with this algorithm, then knowing the keyword would be enough. Someone has found out how the keyword is computed from the large key-string, but because he is not a very experienced computer programmer, he needs your help. The key-string consists of N characters from the set {'a','b'}. The keyword is the shortest non-empty string made up of the letters 'a' and 'b', which is not contained as a contiguous substring (also called subsequence) inside the key-string. It is possible that more than one such string exists, but the algorithm is designed in such a w

【翻译】

【每个测试点时间】1s.
【每个测试点内存】16384KB

Kevin发明了一个新的加密解密方法,他自以为这个方法很牛X.这个方法要使用非常大的key-string(关键字符串), 用来加密的关键字可以由这个key-string通过一定的规则得到.现在,以这个关键字为基础,加密解密就很容易了.所以,如果有人想破解这个算法加密的信息,只需要知道关键字就可以了.后来有人发现了这个key-string和加密算法,但是他不会写程序,所以只能请求你的帮助.
key-string由 N 字符组成,每个字符都属于集合{'a','b'}.那么关键字就是由 'a' 和 'b'组成的,不是key-string的子串的(也就是key-string不包含关键字)最短的字符串.可能存在多个这样的字符串,但是根据加密算法的特殊性质,任意一个这样的字符串都能满足要求.现在你知道 key-string,你的任务是求出一个关键字.

【输入】第一行是正整数 N,描述key-string的长度 (1 <= N <= 500 000).第二行有 N 个属于{'a','b'}的字符, 代表key-string的内容.
【输出】第一行输出关键字的长度,第二行输出关键字内容.

【样例输入】
11
aabaaabbbab
【样例输出】
4
aaaa

142 . 关键字时限: 2秒,内存限制: 至少16 MB凯文先后发明了一种新算法隐窝和解密的讯息,他认为是无法言喻的. 该算法利用一个非常大的关键字符串,其中一个关键字后发现,采用该算法. 然后,基于这个关键字,我们的信息很容易crypted或解密. 所以,如果你想尝试一些解密讯息crypted这种算法,然后知关键字那就足够了. 有人发现了如何使用关键字的计算方法是从大型关键字符串 但是,因为他不是一个非常有经验的计算机程序员,他需要你的帮助. 钥匙串由n个字符集( '一' , '二' ) . 关键字是最短的非空字符串组成的英文字母&#