Codeforce:131A. cAPS lOCK

原题链接

╮(╯▽╰)╭这题题目一开始没看明白,导致wa几次。如果全是大写或者出了首字母是小写其他为大写,则转换为第一个字母大写,其他的小写 ,如果不是以上两种情况则不作处理。
╮(╯▽╰)╭水题还错。

#include<bits/stdc++.h>
using namespace std;
int main() {
    string s; cin >> s; int f = 1;
    for (int i = 1; i < s.length();)f &= (s[i++] < 'a');
    for (int i = 0; i < s.length();)cout << (char)(s[i++] ^ (f * 32));
}
原文地址:https://www.cnblogs.com/RioTian/p/13162182.html