Given a string of character, find the length of longest proper prefix which is also a proper suffix.
S = abab
lps is 2 because, ab.. is prefix and ..ab is also a suffix.
First line is T number of test cases. 1<=T<=100.
Each test case has one line denoting the string of length less than 100000.
Expected time compexity is O(N).
Print length of longest proper prefix which is also a proper suffix.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.