Dfs In Suffix Tree

hard
Suffix Tree is implemented for you, you just have to write the code for DFS traversal and print all the suffixes in lexicographical order

Input Format

Given a string S

Output Format

Output each suffix in lexicographical order on different lines

Constraints

|S| <= 10^5

Example

Input
abca
Output
$
a$
abca$
bca$
ca$
Previous
Hidden Password - Icpc Regionals
Next
Sufix Tree - Application 1 - Pattern Find

Related Questions