Barbara is making candy bags for her birth party. She has 24 lollipops, 12 candy bars, and 42 pieces of gum. She wants each bag to have the same amount of each kind of candy. What is the greatest number of bags she can make if all of the candy is used? How many pieces of candy will be in each bag?