def arrangeWords(self, text: str) -> str:
        words = text.split()
        table = collections.defaultdict(list)
        for word in words:
            table[len(word)].append(word)
        result = []
        for key in sorted(table):
            result.extend(table[key])

        return ' '.join(result).capitalize()