📄 d.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0044)http://plg.uwaterloo.ca/~acm00/020601/D.html -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=GB18030">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff><IMG src="D.files/eric.jpg" align=right>
<H2>Problem D: Power Strings</H2>Given two strings <I>a</I> and <I>b</I> we
define <I>a*b</I> to be their concatenation. For example, if <I>a = "abc"</I>
and <I>b = "def"</I> then <I>a*b = "abcdef"</I>. If we think of concatenation as
multiplication, exponentiation by a non-negative integer is defined in the
normal way: <I>a^0 = ""</I> (the empty string) and <I>a^(n+1) = a*(a^n)</I>.
<P>Each test case is a line of input representing <I>s</I>, a string of
printable characters. For each <I>s</I> you should print the largest <I>n</I>
such that <I>s = a^n</I> for some string <I>a</I>. The length of <I>s</I> will
be at least 1 and will not exceed 1 million characters. A line containing a
period follows the last test case.
<H3>Sample Input</H3><PRE>abcd
aaaa
ababab
.
</PRE>
<H3>Output for Sample Input</H3><PRE>1
4
3
</PRE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -