For problem statement at 1000-1999/1400-1499/1490-1499/1492/problemC.txt this is a correct solution, but verifier at 1000-1999/1400-1499/1490-1499/1492/verifierC.go ends with panic: runtime error: index out of range [23] with length 21
goroutine 1 [running]:
main.genCase(0x4000072e80)
/home/ubuntu/codeforces/1000-1999/1400-1499/1490-1499/1492/verifierC.go:58 +0x2d0
main.main()
/home/ubuntu/codeforces/1000-1999/1400-1499/1490-1499/1492/verifierC.go:81 +0x25c
exit status 2 can you fix the verifier? package main
import (
"bufio"
"fmt"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
var n, m int
fmt.Fscan(reader, &n, &m)
var s, t string
fmt.Fscan(reader, &s, &t)
L := make([]int, m)
pos := 0
for i := 0; i < m; i++ {
for s[pos] != t[i] {
pos++
}
L[i] = pos
pos++
}
R := make([]int, m)
pos = n - 1
for i := m - 1; i >= 0; i-- {
for s[pos] != t[i] {
pos--
}
R[i] = pos
pos--
}
ans := 0
for i := 0; i < m-1; i++ {
if R[i+1]-L[i] > ans {
ans = R[i+1] - L[i]
}
}
fmt.Println(ans)
}