This question is inspired by, and is the inverse of this one.
E), Doorknob (
D), Martin (
M) and Chris (
C) have ordered a pizza. The rectangular pizza is divided into square pieces, each marked with their intended eater.
Write a program or function that given a rectangular pizza consisting of 0 or more of each letter determines whether:
Each slice for each person is path-connected. This means that all letters that are the same should be directly adjacent to eachother (no diagonal connections).
The number of slices per person is the same for all.
You must output a truthy/falsy value with an optional trailing newline that indicates whether or not the given pizza is fair.
DDDDDDDDDDDDMCCCCCCCCCCC DEEEEEEEEEEDMMMMMMMCCCCC DEEEEEEEEEEDMMMCCCCCCCCC DEEEEEEEEEEDMMMMMMMMCCCC DDDDDDDDDDDDMMMMMMMMMMMC
DD EE MC MC
DDDDDDDDDDDDMCCCCCCCCCCC DEEEEEEEEEEDMMMMMMMCCCCC DEEEEEEEEEEMDMMCCCCCCCCC DEEEEEEEEEEDMMMMMMMMCCCC DDDDDDDDDDDDMMMMMMMMMMMC
Shortest code in bytes wins.