Automatically add words if Duplicate Post Titles

i have two post duplicate Post Titles: “Love Story”.

i want code Automatically add a random words if Duplicate Post Titles, like post 2 duplicate Titles ==> auto change post 2 titles like: “Love Story Two”.

and if user up post 3, duplicate Titles again => auto add random words in post titles like : “Love story three”.

thanks a lot