← Home
For problem statement at 1000-1999/1800-1899/1830-1839/1837/problemB.txt this is a correct solution, but verifier at 1000-1999/1800-1899/1830-1839/1837/verifierB.go ends with All tests passed can you fix the verifier? package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		var n int
		var s string
		fmt.Scan(&n, &s)
		maxLen := 1
		currLen := 1
		for j := 1; j < n; j++ {
			if s[j] == s[j-1] {
				currLen++
			} else {
				if currLen > maxLen {
					maxLen = currLen
				}
				currLen = 1
			}
		}
		if currLen > maxLen {
			maxLen = currLen
		}
		fmt.Println(maxLen + 1)
	}
}