1

=ARRAYFORMULA({UNIQUE(INDIRECT("A2:A"&COUNTA(A1:A)))\ TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(QUERY(QUERY(A2:B; "select count(A) where A is not null group by A pivot B"; 0); "offset 1"; 0)<>""; QUERY(A2:B; "select count(A) where A is not null group by A pivot B limit 0"); )); ; 999^99)))})


Only top voted, non community-wiki answers of a minimum length are eligible