Under construction

Still being built. Things may change

Lengths and Periods

Time limit2sMemory limit512 MB

Summary
Given a string of up to 200,000 lowercase letters, find its critical exponent, the largest repetition ratio of a substring, printed as an irreducible fraction.
Level

Hard9 of 10

Topics
String, String matching, Divide and conquer
Solved
No attempts yet

Problem

In mathematics and computer science, the critical exponent of a string is the largest number of times a contiguous substring repeats in a row. The value can be a fraction. For example, the critical exponent of "Mississippi" is 7/37/3, because it contains the substring "ississi", which has length 7 and period 3. Let ww and xx be non-empty strings. xx occurs in ww with exponent α\alpha, for a positive rational α\alpha, if ww has a substring yy with y=xnx0y = x^n x_0, where xnx^n is xx repeated nn times, x0x_0 is a prefix of xx, nn is the integer part of α\alpha, and ∣y∣=α∣x∣|y| = \alpha |x|. The critical exponent of ww is the maximum α\alpha over all xαx^\alpha that occur in ww.

Input

The only line contains a string ww, a sequence of lowercase English letters, where 1≤∣w∣≤200 0001 \le |w| \le 200\,000.

Output

Output the critical exponent of ww as an irreducible fraction p/qp/q, where pp and qq are integers without leading zeros.

Examples2

  1. Example 1

    Input
    mississippi
    
    Expected output
    7/3
    
  2. Example 2

    Input
    abab
    
    Expected output
    2/1