Partition list AC. (Faster version is possible)