PAT 1021 (JAVA is not the tea for PAT, it uses more memory, and takes
more time)