This repository has been archived on 2023-05-13. You can view files and clone it, but cannot push or open issues or pull requests.
mipt_cpp/seminar03_initialization/01_letter_case_switch/main.cpp

23 lines
389 B
C++
Raw Normal View History

2022-10-22 18:26:37 +03:00
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
string letter_case_switch(const string & str)
{
string result = str;
if (str.size() == 0)
return result;
result[0] =
isupper(result[0]) ? tolower(result[0]) : toupper(result[0]);
return result;
}
int main()
{
string meow;
cin >> meow;
cout << letter_case_switch(meow) << endl;
}