Marks :10
: 8 | : 0
For two strings S and T, we say "T divides S" if and only if S = T + ... + T (i.e., T is concatenated with itself one or more times).
Given two strings str1 and str2, return the largest string x such that x divides both str1 and str2.
The first line of input consists of string str1 of 104≤size≤104 and consisting of uppercase latin letters only
The second line of input consists of string str2 of 104≤size≤104 and consisting of uppercase latin letters only
Output x as described in the statement and if the answer does not exist you can output empty string.
ABCABC ABC
ABC
ABABAB ABAB
AB
ABHCHDBHC AJBDHBCH
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.