The tilde (~) is a special character that is used in many different languages and contexts. It is often used…