Redirecting to
NADOS

Longest Prefix Suffix

Given a string S, print the longest Prefix which is also a suffix.
Try doing it using constant space.
Input Format
A string S
Output Format
Print the answer, print "" (without quotes) if no answer found.
Question Video
Constraints
2 <= |S| <= 10^5
Sample Input
abcab
Sample Output
ab


  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name