← Home
For problem statement at 0-999/0-99/0-9/3/problemA.txt this is a correct solution, but verifier at 0-999/0-99/0-9/3/verifierA.go ends with All tests passed can you fix the verifier? package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var s, t string
	if _, err := fmt.Fscan(in, &s); err != nil {
		return
	}
	fmt.Fscan(in, &t)

	sx := int(s[0] - 'a')
	sy := int(s[1] - '1')
	tx := int(t[0] - 'a')
	ty := int(t[1] - '1')

	moves := []string{}

	for sx != tx || sy != ty {
		m := ""
		if sx < tx {
			m += "R"
			sx++
		} else if sx > tx {
			m += "L"
			sx--
		}
		if sy < ty {
			m += "U"
			sy++
		} else if sy > ty {
			m += "D"
			sy--
		}
		moves = append(moves, m)
	}

	fmt.Fprintln(out, len(moves))
	for _, mv := range moves {
		fmt.Fprintln(out, mv)
	}
}