You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
653 B
39 lines
653 B
#include <iostream>
|
|
#include <string>
|
|
using namespace std;
|
|
|
|
string parseString(string n) {
|
|
string m = n;
|
|
string o = n;
|
|
for (int i = 0; i < n.length(); i++) {
|
|
m[i] = toupper(n[i]);
|
|
}
|
|
o = m;
|
|
o[0] = tolower(m[0]);
|
|
if (m == n) {
|
|
return "v1";
|
|
} else if (o == n) {
|
|
return "v2";
|
|
} else {
|
|
return "v3";
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
string n;
|
|
cin >> n;
|
|
string w;
|
|
w = parseString(n);
|
|
if (w == "v3") {
|
|
cout << n << endl;
|
|
} else {
|
|
for (int i = 0; i < n.length(); i++) {
|
|
if (i == 0 && w == "v2") {
|
|
n[0] = toupper(n[0]);
|
|
} else {
|
|
n[i] = tolower(n[i]);
|
|
}
|
|
}
|
|
cout << n << endl;
|
|
}
|
|
}
|
|
|