You are given a string s, a string chars of distinct characters, and an integer array vals of the same length as chars.
The value of each character is defined as follows:
If the character appears in chars at index i, its value is vals[i].
Otherwise, its value is its 'a' has a value of 'b' has a value of 'z' with a value of
The cost of a substring is the sum of the values of its characters. The cost of an empty substring is defined as
Return the maximum cost among all substrings of s.
Constraints:
s.length
s consists of lowercase English letters.
chars.length
chars consists of distinct lowercase English letters.
vals.length chars.length
vals[i]
You are given a string s, a string chars of distinct characters, and an integer array vals of the same length as chars.
The value of each character is defined as follows:
If the character appears in chars at index i, its value is vals[i].
Otherwise, its value is its 'a' has a value of 'b' has a value of 'z' with a value of
The cost of a substring is the sum of the values of its characters. The cost of an empty substring is defined as
Return the maximum cost among all substrings of s.
Constraints:
s.length
s consists of lowercase English letters.
chars.length
chars consists of distinct lowercase English letters.
vals.length chars.length
vals[i]