Partition the string based on the pivot