You are given a sequence of white (W) and black (B) bricks. The goal is to partition it into
some number of non-empty, contiguous blocks, each one having the same ratio of white and black
bricks.
Of course one can always "partition'7 the sequence into one single block (which is not very
interesting). We want, however, to have as manv blocks as possible. Consider for example the
following sequences and its partitions:
●BWWWBB
BW + WWBB (rati0 1:1)
~ WWWBBBWWWWWWWWWB
WWWB + BBWWWWWW + WWWB (rati0 3:1)
Note that both of these partitions are optimal with respect to the number of blocks