Hurontario is a cool street name. It contains both Huron and Ontario. They share two letters, on
. Given two strings
Constraints
For
For the remaining
Input Specification
A single line will contain two space separated strings consisting of only uppercase Latin characters,
Output Specification
A single string described in the problem statement.
Sample Input 1
Copy
HURON ONTARIO
Sample Output 1
Copy
HURONTARIO
Sample Input 2
Copy
NEW YEARS
Sample Output 2
Copy
NEWYEARS
Sample Input 3
Copy
YEAR EARWIG
Sample Output 3
Copy
YEARWIG
Comments
is linear time complexity too slow?
Linear time is intended, your solution runs in quadratic time (checking string equality is linear in the length of the string)
what the output will be if the input is TROUBLE OUBE ??
TROUBLEOUBE
There is no common suffix of A and prefix of B
Can anyone tell me why I am getting an index error on Batch #1, Case #15?
I think it's due to your second forloop. I can't pinpoint your exact issue but try troubleshooting with the test case BAHAHABA HAHA
For the constraints, do they apply to the input strings or the output string?