Adding the grouping function for strings.