Find and replace in Column names?

I have merged 4 datasets side by side so the data is joined by rows.

Now I want to replace (right)(right) with a name indicating which dataset it came from.

In other words I want to do a search and replace as follows:

(right) becomes A

(right)(right) becomes B

(right)(right)(right) becomes C

and so on

Is anyone aware of a find and replace in column names?

Many thanks,

Mark