Laundry Algorithm Solution