Ctrl K

The Sneaked-In Letter

Easy
Someone took the string before, shuffled its letters and slipped one more letter in at a random spot. The result is the string after. Return the letter that was added. It may be the same as a letter that was already there.
Example 1
before="lamp", after="pmlaz" → 'z'

The letters l, a, m, p were shuffled, and the new letter is z.

Example 2
before="noon", after="onnon" → 'n'

The original has two n's and the new string has three, so an n was added.

Example 3
before="", after="q" → 'q'
Constraints
  • 0 ≤ len(before) ≤ 1000
  • len(after) = len(before) + 1
  • Both strings consist of lowercase English letters
  • after is before shuffled with exactly one letter added
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsOne New Letter MediumSame Letters, Reshuffled EasyShuffle Into a Palindrome EasyThe Lost Ticket EasyDoubled Tag, Lost Tag Easy
loading Python…
Input
before="lamp", after="pmlaz"
Expected
'z'

Run checks the first 3 tests in your browser. Submit checks all 87 tests on the server, hidden ones included.