digit triplet length logic extracted into separate method