All tasks
Harddpstrings

Edit Distance

Time limit 2 s · Memory 64 MBAcceptance: —Solved by: 0

Statement

Two lines contain two strings s and t of lowercase Latin letters. Print the minimum number of operations turning s into t. Allowed operations: insert one character, delete one character, replace one character with another.

Examples

Example 1
Input
kitten
sitting
Output
3
Example 2
Input
abc
abc
Output
0

Constraints

  • Each string has length between 1 and 2000
Solve this task to unlock the editorial.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.