a,b,c shared pencils in the ratio 3:5:7 respectively. If c got 12 pencils more than a, how many pencils did they share altogether?

7x = 3x+12

Find x, and then they received 15x in total.

Or, since 7-3 = 4, and you want the difference to be 12, multiply all the ratios by 3 and you have
9:15:21
see how c-a = 12 now?