So I have a bit of text that I have to pass into a playfair cipher to be encrypted. The issue is I want to preserve the punctuation that is used in the string. For example "Timmy, What's your favorite color?" might be the string I want to encrypt. I need a way that whenever the text is encrypted it removes the punctuation and then adds it back into the output so for the above example I might get "chds, xgdd'a ywte gdfabyqt olshf?". I also need to be able to do the same when the message is then decoded. Any help is appreiated!
PS: Don't need any help with the key portion. Just the PT to CT punctuation preservation.