another solution that can be improved !
use TreeMap, more performant