Longest Prefix Suffix
Given a string S, print the longest Prefix which is also a suffix.Input Format
Try doing it using constant space.
A string SOutput Format
Print the answer, print "" (without quotes) if no answer found.Question Video
2 <= |S| <= 10^5Sample Input
abcabSample Output
ab
-
Asked in Companies
-
Related Topics
Video Solution
Code Solution
{ }
{ }
Run