String Problem
题号:NC230857
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

JB hates solving string problems. Therefore, when his friend Potato gives him a string problem to solve, he immediately gives it to you and continues playing Genshin Impact, the greatest game in the world.

You are given a string and then for each nonempty prefix, you need to find the largest substring in lexicographical order and point out the leftmost occurrence of the largest substring.

输入描述:

The only line contains a string  , which consists of lowercase Latin letters, 'a' to 'z'.

输出描述:

Output  lines, the i-th of which contains two integers l_i and r_i, indicating the leftmost occurrence of the largest substring in the prefix of length i.
示例1

输入

复制
potato

输出

复制
1 1
1 2
3 3
3 4
3 5
5 6
示例2

输入

复制
pbpbppb

输出

复制
1 1
1 2
1 3
1 4
1 5
5 6
5 7