function that gives every char the number of his word