You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: b.go
    path of file: ./repos/codeforces-go/leetcode/biweekly/101/b
    
    the code of the file until where you have to start completion: package main

// https://space.bilibili.com/206214
func maximumCostSubstring(s, chars string, vals []int) (ans int) {
	mapping := [26]int{}
    
func maximumCostSubstring(s, chars string, vals []int) (ans int) {
	mapping := [26]int{}
	for i := range mapping {
		mapping[i] = i + 1
	}
	for i, c := range chars {
		mapping[c-'a'] = vals[i]
	}
	// 最大子段和（允许子数组为空）
	f := 0
	for _, c := range s {
		f = max(f, 0) + mapping[c-'a']
		ans = max(ans, f)
	}
	return ans
}