Given two strings string1 and string2 and we have to perform operations on string1. Find minimum number of edits (operations) required to convert ‘string1 ’ into ‘string2’.
We can do these three operation:
- Insert a character at any position of the string.
- Remove any character from the string.
- Replace any character from the string with any other character.
Now, modify your offline code to consider the following costs for each operation:
- Insert : 1
- Remove: 1
- Replace: 2
Finally, print the total cost to convert String1 to String2.