#P15432. [ICPC 2026 APC] Compare Suffixes
[ICPC 2026 APC] Compare Suffixes
Problem Description
This task was originally an interactive problem from ICPC Asia Pacific Championship 2026. For Hydro OJ, it has been converted into a normal output-checking problem.
You are given a lowercase string of length . For an integer , let denote the suffix of starting from the -th character.
Your task is to output a permutation of such that
in lexicographical order.
Because all suffixes starting at different positions are distinct, the answer is unique.
Input Format
The input contains one line: a lowercase string .
The special judge also supports the format n S, but the recommended data format is a single string line.
Output Format
Output integers , representing the starting positions of all suffixes in increasing lexicographical order.
For compatibility with the original interactive statement, the special judge also accepts the format:
answer p1 p2 ... pn
However, in this Hydro version, contestants should not output query operations.
Constraints
consists only of lowercase Latin letters a to z.
Sample
Input
icpc
Output
4 2 1 3
Explanation
For , the suffixes are:
Their lexicographical order is:
so one valid output is 4 2 1 3.