Challenge: Reverse Everything in a String

Complete this hands-on exercise to test your knowledge.

Problem statement

Write a function that takes the given string and returns a new string that contains the same characters in reversed order as the original string. Additionally, the case of each character is also reversed. In other words, if a character is uppercase in the original string, it should be lowercase in the new string, and vice versa.

You must use the forward and reverse iterators to loop over the string.

Note: Use std::isupper and std::islower from the C++20 STL to check the case of each character, and std::toupper and std::tolower to change the case of each character.

Input

Get hands-on with 1200+ tech skills courses.