Min Cost to Remove Subsequence (Minimal Cost To Strengthen Password :)
Team of developers at Amazon is working on a feature that checks the strength of a password as it is set by a user.
Analysts found that people use their personal information in passwords, which is insecure. The feature searches for the presence of a reference string as a subsequence of any permutation of the password. If any permutation contains the reference string as a subsequence, then the feature determines the minimum cost to remove characters from password so that no permutation contains the string reference as a subsequence.
The removal of any character has a cost given in an array, cost, with 26 elements that represent the cost to replace 'a' (cost[0]) through 'z' (cost[25]). Given two strings password and reference, determine the minimum total cost to remove characters from password so that no permutation contains the string reference as a subsequence.
Given the following:
They want you to write a function that computes the minimum total cost necessary to modify the password by deleting characters, ensuring that no permutation of the altered password contains the target as a subsequence.
Notes:
1Example 1
2Example 2
3Example 3

4Example 4

Constraints
Limits and guarantees your solution can rely on.