• [I] Keyword

  • 时间限制: 5000 ms 内存限制: 262144 K
  • 问题描述
  • Given a string S, this string only contain letter 'a', 'b'.

    You should find a string T (also only contain letter 'a', 'b'), so that the string T is not the substring of the string S and the length of the string T as small as better!

    If there are multiple solutions, output lexicographically smallest one.

  • 输入
  • There are multiple test cases, each test case contain two parts:
    1. A positive integer N (1 <= N <= 500,000), represent the length of string S.
    2. String S.
  • 输出
  • For each test case, output should contain two parts:
    1. L (the length of the string T).
    2. String T.
    See sample detail.
  • 样例输入
  • 11
    aabaaabbbab
  • 样例输出
  • 4
    aaaa
  • 提示
  • 来源
  • 本站或者转载
  • 操作

显示春菜