82. Longest Common Prefix
Core1000 ms256 MBSolved by 0%
Read two lines and print the longest run of characters they both start with.
If they share no first character, print None.
Constraints - Each line has between 1 and 100000 characters. - Printable ASCII only.
Input
Two lines, each containing one string.
Output
Print the longest shared starting run of characters, or None if they share no first character.
Inputflower
flow
Outputflow
Notehas one string as a prefix of the other
Inputdog
cat
OutputNone
Noteshares nothing at all
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.
Hint 1Where to start
Hint 2The approachOpen hint 1 first. This one carries on from it.
Hint 3PseudocodeOpen hint 2 first. This one carries on from it.
Hint 4Full solutionOpen hint 3 first. This one carries on from it.