{"id":"3f4494cc-2ad5-49a7-b1c3-a35c27b71f03","name":"Lexicographical Suffixes","description":"Given a string, print all suffixes of it in lexicographical order.","inputFormat":"A string S.","outputFormat":"Print |S| lines, each having a suffix.","constraints":"|S| <= 10^5","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.util.*;\r\n\r\npublic class Main {\r\n public static void main(String[] args) {\r\n Scanner scn = new Scanner(System.in);\r\n // Write Code here\r\n scn.close();\r\n }\r\n}"},"ruby":{"code":""},"python":{"code":""},"javascript":{"code":""}},"points":10,"difficulty":"hard","sampleInput":"bananaban","sampleOutput":"aban\r\nan\r\nanaban\r\nananaban\r\nban\r\nbananaban\r\nn\r\nnaban\r\nnanaban\r\n","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"a2073e25-96a1-4875-b400-f40bbe2edd95","name":"Text Processing For Experts","slug":"text-processing-for-experts-859","type":0},{"id":"fa634ac6-6b8c-4c11-a927-ba7b57bdb42b","name":"Lexicographical Suffixes","slug":"lexicographical-suffixes","type":1}],"next":{"id":"d224d03a-ccf3-4968-95a2-268c01dd4582","name":"Longest Common Substring (2 Strings)","type":1,"slug":"longest-common-substring-2-strings"},"prev":{"id":"adf48575-67c0-4be1-a34a-54f80390f0a1","name":"Longest Prefix Suffix","type":1,"slug":"longest-prefix-suffix"}}}

Lexicographical Suffixes

Given a string, print all suffixes of it in lexicographical order.

{"id":"3f4494cc-2ad5-49a7-b1c3-a35c27b71f03","name":"Lexicographical Suffixes","description":"Given a string, print all suffixes of it in lexicographical order.","inputFormat":"A string S.","outputFormat":"Print |S| lines, each having a suffix.","constraints":"|S| <= 10^5","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.util.*;\r\n\r\npublic class Main {\r\n public static void main(String[] args) {\r\n Scanner scn = new Scanner(System.in);\r\n // Write Code here\r\n scn.close();\r\n }\r\n}"},"ruby":{"code":""},"python":{"code":""},"javascript":{"code":""}},"points":10,"difficulty":"hard","sampleInput":"bananaban","sampleOutput":"aban\r\nan\r\nanaban\r\nananaban\r\nban\r\nbananaban\r\nn\r\nnaban\r\nnanaban\r\n","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"a2073e25-96a1-4875-b400-f40bbe2edd95","name":"Text Processing For Experts","slug":"text-processing-for-experts-859","type":0},{"id":"fa634ac6-6b8c-4c11-a927-ba7b57bdb42b","name":"Lexicographical Suffixes","slug":"lexicographical-suffixes","type":1}],"next":{"id":"d224d03a-ccf3-4968-95a2-268c01dd4582","name":"Longest Common Substring (2 Strings)","type":1,"slug":"longest-common-substring-2-strings"},"prev":{"id":"adf48575-67c0-4be1-a34a-54f80390f0a1","name":"Longest Prefix Suffix","type":1,"slug":"longest-prefix-suffix"}}}
plane

Editor


Loading...

Lexicographical Suffixes

hard

Given a string, print all suffixes of it in lexicographical order.

Constraints

|S| <= 10^5

Format

Input

A string S.

Output

Print |S| lines, each having a suffix.

Example

Sample Input

bananaban

Sample Output

aban an anaban ananaban ban bananaban n naban nanaban

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode