I got a table like this

Category is a multiple selection, the count simply is the number of occurrences. I want to tranform to this table
.
In python, i can use xplode function. But u want using formular or appscript in googlesheets to solve this problem. I try arrayformular, and split. But it's not worked
Here's a possible solution: