I don't think I'd use strtok for that, just loop through the input string and pick out groups of digits.