Right alignment refers to the right positioning of a visual element in a GUI.
Suppose I have a string s which is given below: string s="i am\ngoing\nto\ncuet"; I want to …