CT139

Find the Shared Opening Phrase

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Two publishers compare the first words of titles to find their shared opening text. Task: Find the longest common prefix of the two lowercase strings. Input format: Two nonempty lowercase English strings s and t. Output format: Print their longest common prefix; print - if they share no first character. Constraints: 1 <= length(s),length(t) <= 100000

Example 1:

Input: codetikki codebase
Output: code

Example 2:

Input: abc abd
Output: ab

Example 3:

Input: hello world
Output: -

Constraints:

1 <= length(s),length(t) <= 100000

Tags:

strings prefix
Loading...
Test Cases:No test cases
No test cases available.
Find the Shared Opening Phrase - EASY Coding Problem | CodeTikki