first and second of lowercase English letters. You may delete any characters from either string; deleting a character costs its ASCII code (a is 97, b is 98, …, z is 122).
Delete characters so that the two strings become equal (possibly both empty). Return the smallest total cost of the deletions.first="cat", second="act" → 194
Delete a from both strings, leaving ct. The cost is 97 + 97 = 194. Keeping at instead would mean deleting both cs: 99 + 99 = 198.
first="abc", second="xyz" → 657
No letters in common, so everything goes: 97 + 98 + 99 + 120 + 121 + 122 = 657.
first="cat", second="act"
194
Run checks the first 3 tests in your browser. Submit checks all 117 tests on the server, hidden ones included.