For problem statement at 0-999/700-799/730-739/730/problemH.txt this is a correct solution, but verifier at 0-999/700-799/730-739/730/verifierH.go ends with All tests passed can you fix the verifier? package main
import (
"bufio"
"fmt"
"os"
)
func match(s string, p []byte) bool {
if len(s) != len(p) {
return false
}
for i := 0; i < len(p); i++ {
if p[i] != '?' && p[i] != s[i] {
return false
}
}
return true
}
func main() {
in := bufio.NewReader(os.Stdin)
out := bufio.NewWriter(os.Stdout)
defer out.Flush()
var n, m int
fmt.Fscan(in, &n, &m)
files := make([]string, n)
for i := 0; i < n; i++ {
fmt.Fscan(in, &files[i])
}
del := make([]bool, n)
idx := make([]int, m)
for i := 0; i < m; i++ {
fmt.Fscan(in, &idx[i])
idx[i]--
del[idx[i]] = true
}
base := files[idx[0]]
l := len(base)
for i := 1; i < m; i++ {
if len(files[idx[i]]) != l {
fmt.Fprintln(out, "No")
return
}
}
pattern := []byte(base)
for pos := 0; pos < l; pos++ {
c := base[pos]
for i := 1; i < m; i++ {
if files[idx[i]][pos] != c {
pattern[pos] = '?'
break
}
}
}
for i := 0; i < n; i++ {
if !del[i] && match(files[i], pattern) {
fmt.Fprintln(out, "No")
return
}
}
fmt.Fprintln(out, "Yes")
fmt.Fprintln(out, string(pattern))
}