def process_complexes(str_in):
    """
    Function splits strings at '.' and moves any preceding number to the end
    so A.nB -> A+(B)n
    :param str_in: molecular formula that may or may not contain complexes
    :return: reformatted string
    """
    def _move_num_to_end(s):
        # move initial numbers to end
        alpha_idx = [ss.isalpha() for ss in s].index(True)
        str_re = "({}){}".format(s[alpha_idx:],s[0:alpha_idx])
        return str_re
    if '.' not in str_in:
        return str_in
    str_in = str_in.split(".")
    str_out = ["{}".format(s)  if s[0].isalpha()   else _move_num_to_end(s)  for s in str_in ]
    str_out =  "+".join(str_out)
    return str_out