Tell me about the LeetCode-style variants you practiced, especially those involving string and array manipulation.
For this hands-on variant, implement an algorithm that groups anagrams from an array of lowercase strings. Preserve the order in which groups first appear and preserve the original order within each group.
Input: a list of strings. Output: a list of grouped string lists.
def group_anagrams(words):