22353_PowerStrings

2022-5-16 18:21| 发布者: Hocassian| 查看: 19| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506348776100-Problem List-采集的数据-后羿采集器.html

Pro.ID

22353

Title

Power Strings

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22353

AC

13

Submit

42

Ratio

30.95%

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others)
  • 描述

    Given two strings a and b we define a×b to be their concatenation. For example, if a = "abc" and b = "def" then a×b = "abcdef". If we think of concatenation as multiplication, exponentiation by a non-negative integer is defined in the normal way: a0 = "" (the empty string) and a(n+1) = a×(an).

    输入

    Each test case is a line of input representing s, a string of printable characters. The length of s will be at least 1 and will not exceed 1 million characters. A line containing a period follows the last test case.

    输出

    Description

    Given two strings a and b we define a×b to be their concatenation. For example, if a = "abc" and b = "def" then a×b = "abcdef". If we think of concatenation as multiplication, exponentiation by a non-negative integer is defined in the normal way: a0 = "" (the empty string) and a(n+1) = a×(an).

    Input

    Each test case is a line of input representing s, a string of printable characters. The length of s will be at least 1 and will not exceed 1 million characters. A line containing a period follows the last test case.

    Output

    For each s you should print the largest n such that s = an for some string a.

    Sample Input

    abcd
    aaaa
    ababab
    .

    Sample Output

    1
    4
    3

    Source

    样例输入

    abcd
    aaaa
    ababab
    .

    样例输出

    1
    4
    3

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部