[build][core] function to calculate spaces between tokens (update)