|Well, I see 2 issues with your question:|
1 - Your input data has a string in Column B that ends in ff, but not one that ends in zz. Your output data has one that ends in zz but not in ff. I'm not quite sure how we would make that happen for you.
2 - If you need the output in column B, you're going to have to use some sort of VBA store and sort routine in order to replace the data that is currently there. If the output can be in Column C, I think it can be done with a VLOOKUP formula, once you tell us how to resolve the first issue.