A lady behaves like a teacher in a classroom, mother or daughter in a home and
customer in a market. Here, a single person is behaving differently according to the
situations. Consider a above real-life example and which concept you will use in cpp.
Elaborate the concept.
str1 = "abcdefghijklmnopqrstuvwxyz"
str1_upp = str1.upper()
str2 = "zyxwvutsrqponmlkjihgfedcba"
str2_upp = str2.upper()
table = "".maketrans(str1+str1_upp, str2+str2_upp)
while True:
n = input("Enter a string: ")
if len(n) == 0:
break
print("Traslate: ", n.translate(table))
Comments
Leave a comment