Source: https://dept-info.labri.fr/~griffaul/Enseignement/ASD/corrige.pdf