def _generate_shape(word: str) -> str:
        """
        Recreate shape from a token input by user
        Args:
            word: str

        Returns: str
        """

        def counting_stars(w) -> List[int]:
            count = [1]
            for i in range(1, len(w)):
                if w[i - 1] == w[i]:
                    count[-1] += 1
                else:
                    count.append(1)

            return count

        shape = ""
        p = 0
        for c in counting_stars(word):
            if c > 4:
                shape += word[p:p + 4]
            else:
                shape += word[p:p + c]
            p = p + c

        return shape
def _generate_shape ( word : str ) -> str : def counting_stars ( w ) -> List [ int ] : count = [ 1 ] for i in range ( 1 , len ( w ) ) : if w [ i - 1 ] == w [ i ] : count [ - 1 ] += 1 else : count . append ( 1 ) return count shape = "" p = 0 for c in counting_stars ( word ) : if c > 4 : shape += word [ p : p + 4 ] else : shape += word [ p : p + c ] p = p + c return shape
Recreate shape from a token input by user
        Args:
            word: str

        Returns: str