def expand_star_syntax(s):
    """
    Evaluate star syntax. Return new string
    Remember that Abinit does not accept white spaces.
    For example `typat 2 * 1` is not valid.

    >>> assert expand_star_syntax("3*2") == '2 2 2'
    >>> assert expand_star_syntax("2 *1") == '1 1'
    >>> assert expand_star_syntax("1 2*2") == '1 2 2'
    >>> assert expand_star_syntax("*2") == '*2'
    """
    s = s.strip()
    if '*' not in s:
        return s
    elif s[0].isalpha() and s[-1] == '*':
        return s
    s = s.replace('*', ' * ').strip()
    tokens = s.split()
    if len(tokens) == 2 and tokens[0] == '*':
        assert tokens[1] != '*'
        return ''.join(tokens)
    l = []
    while tokens:
        c = tokens.pop(0)
        if c == '*':
            num = int(l.pop(-1))
            val = tokens.pop(0)
            l.extend(num * [val])
        else:
            l.append(c)
    return ' '.join(l)
