Source: https://kiteb.net/education/informatique/bac/bacinfo2017/bacinfo2017sc-corrige2.pdf