Butterflies usually suck nectar or flower honey but there are some types that like to the liquid in the suction like from rotten fruit that has fallen to the ground, carcasses, bird droppings and wet soil, while at the time of being a caterpillar, caterpillars only eat leaves .
Thanks @goodkarma