CF131A.cAPS lOCK
入门
通过率:0%
时间限制:0.50s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's consider that a word has been typed with the Caps lock key accidentally switched on, if:
- either it only contains uppercase letters;
- or all letters except for the first one are uppercase.
In this case we should automatically change the case of all letters. For example, the case of the letters that form words "hELLO", "HTTP", "z" should be changed.
Write a program that applies the rule mentioned above. If the rule cannot be applied, the program should leave the word unchanged.
我们为何需要大写锁定键(Caps Lock)?
Caps Lock 是计算机键盘上的一个按键。按下它后,将进入一种输入模式,在该模式下键入的字母默认为大写。如果误按了该键,就会导致类似第一段中发生的错误。
我们定义:当一个单词在 Caps Lock 键被意外开启的状态下输入时,满足以下任一条件:
- 该单词仅由大写字母组成;
- 该单词除首字母外,其余所有字母均为大写。
此时,我们应自动将该单词中所有字母的大小写进行转换。例如,对于单词 “hELLO”、“HTTP”、“z”,应当改变其中所有字母的大小写。
请编写一个程序,应用上述规则。若该规则不适用于某个单词,则程序应保持该单词不变。
输入格式
The first line of the input data contains a word consisting of uppercase and lowercase Latin letters. The word's length is from 1 to 100 characters, inclusive.
输入数据的第一行包含一个由大写和小写拉丁字母组成的单词。该单词的长度为 1 到 100 个字符(含端点)。
输出格式
Print the result of the given word's processing.
输出给定单词处理后的结果。
输入输出样例
输入#1
cAPS
输出#1
Caps
输入#2
Lock
输出#2
Lock
输入解题思路,AI测评打分。不知道怎么写?