Mark has two pieces of ribbon, one is 18 inches long and the other is 24 inches long. He wants to cut both ribbons into pieces of equal length without any leftover. What is the greatest length of each piece that he can cut from both ribbons? Additionally, how many pieces will he have in total? Let's think step by step and output the final answer within \boxed{}.
user