Question
The Two Words Problem

In a small village of letters, there lived two wordss1 and s2.

They were once identical, but over time, extra letters slipped into them and made them different.

The village rule says:

To make the two words equal again, you may delete letters from either word.

But each deleted letter requires paying its ASCII value as a cost.

Your task is to help the villagers find:

The minimum total cost needed to delete some letters so that both words become exactly the same.

Input
First line will contains a string s1.
Second line will contains a string s2.
Output
Print the lowest ASCII sum of deleted characters to make two words equal.
Example
Input:
sea
eat
Output:
231
Explanation:
Deleting "s" from "sea" adds the ASCII value of "s" (115) to the sum.
Deleting "t" from "eat" adds 116 to the sum.
At the end, both strings are equal, and 115 + 116 = 231 is the minimum sum possible to achieve this.

Input:
delete
leet
Output:
403
Explanation:
Deleting "dee" from "delete" to turn the string into "let",
adds 100[d] + 101[e] + 101[e] to the sum.
Deleting "e" from "leet" adds 101[e] to the sum.
At the end, both strings are equal to "let", and the answer is 100+101+101+101 = 403.
If instead we turned both strings into "lee" or "eet", we would get answers of 433 or 417, which are higher.

Online