You have n people from Group 1, n' people from Group 2, and n'' people from Group 3. You want to place them in a line so that no 2 people from the same group are adjacent. Consider that people from the same group are not distinct. How many ways are there to do this? Can you generalize to k groups?
I was thinking of using stars and bars and I can see how you could do that with 2 groups, but I don't know how to add in the third group after. I also considered doing this with complimentary counting, but I don't know what would be an overcount/undercount. Would appreciate any help.