131A.md (1230B)
1 Source: https://codeforces.com/problemset/problem/131/A 2 3 A. cAPS lOCK 4 5 time limit per test 6 7 0.5 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 wHAT DO WE NEED cAPS LOCK FOR? 22 23 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. 24 25 Let's consider that a word has been typed with the Caps lock key accidentally switched on, if: 26 27 * either it only contains uppercase letters; 28 * or all letters except for the first one are uppercase. 29 30 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. 31 32 Write a program that applies the rule mentioned above. If the rule cannot be applied, the program should leave the word unchanged. 33 34 Input 35 36 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. 37 38 Output 39 40 Print the result of the given word's processing. 41 42 Examples 43 44 Input 45 46 ``` 47 cAPS 48 ``` 49 50 Output 51 52 ``` 53 Caps 54 ``` 55 56 Input 57 58 ``` 59 Lock 60 ``` 61 62 Output 63 64 ``` 65 Lock 66 ```