First I am assuming you worked for the same employer so you have one W2. Your resident state is where you lived on Dec 31 as long as you meet state resident requirment. You will have to file 2 state returns.
If the employer knew of your move it may be split between the two states. If not you will take your state wage and divide it by 12.
9 months will go to Massachusetts and 3 will go to South Carolina. South Carolina does not have a true part-year return. They will tax you either as a full year resident or nonresident. They will then give you a credit from taxes paid to another state.
HOW TO DETERMINE IF YOU ARE A SC RESIDENT FOR TAX PURPOSES