← Home
For problem statement at 0-999/800-899/880-889/888/problemB.txt this is a correct solution, but verifier at 0-999/800-899/880-889/888/verifierB.go ends with All 100 tests passed can you fix the verifier? package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var s string
	fmt.Scan(&s)

	u, d, l, r := 0, 0, 0, 0
	for _, c := range s {
		switch c {
		case 'U':
			u++
		case 'D':
			d++
		case 'L':
			l++
		case 'R':
			r++
		}
	}

	ans := 0
	if u < d {
		ans += 2 * u
	} else {
		ans += 2 * d
	}
	if l < r {
		ans += 2 * l
	} else {
		ans += 2 * r
	}

	fmt.Println(ans)
}