当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6903:Cornelia Street

题目描述
“We bless the rain on Cornelia Street, memorize the creaks in the floor.”

Creak,creak,creak...The drum beats regularly.To keep the number of syllables in harmony, one sentence in chorus is as long as one in verse. However, drumbeats in the chorus is much stronger.

Jessica wants to memorize the music, piano and drumbeat. She records the music and encodes it into a string. So, the recorded string is so strange.

Let A be the pattern of verse and B be the pattern of chorus. So A $\neq$ B and |A| = |B|. The recorded string S is in the pattern of AAA$\cdots$A BB$\cdots$B AAAAA$\cdots$Aa. Formally, it is formed as n times repeat of A, m times repeat of B, k times repeat of A, and the broken piece a at the end is one prefix of A. And note that n,m,k > 0,|a|≥ 0.

Now Jessica wants to know the pattern of A and B. Can you help her?
输入解释
The first line contains a number T (1 ≤ T ≤ 10) denoting the count of testcases.

For each testcase,one line containing a string S (7 ≤|S|≤ $8\times 10^5$).Note that S consists of only lowercase letters and uppercase letters.

It is guaranteed that $\sum$|S| ≤ $4.5\times 10^6$. The patterns in all testcases are generated randomly, but the character sets are different. There are 30% testcases generated in full character set, and the rest 70% are generated in large number of single character and small number of other characters.
输出解释
For each testcase,output one line containing string A and B respectively,separated by one space.If there are multiple answers, choose the shortest one.
输入样例
3
aaaaaaaaaabaabaaaaaa
ABABABABZXCVZXCVABABABA
abcababcacabcacabcababc
输出样例
aaa aba
ABAB ZXCV
abcab abcac
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6903

最后修改于 2021-06-22T18:18:48+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 262144/262144K(Java/Others)