cAPS lOCK

Time Limit:500MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u

Description

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.

Input

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.

Output

Print the result of the given word's processing.

Sample Input

Input
cAPS
Output
Caps
Input
Lock
Output
Lock
 #include <stdio.h>
#include <string.h>
int main()
{
char a[];
int i,j,k;
while(scanf("%s",a)!=EOF)
{
int flg=;
int l=strlen(a);
for(i=;i<l;i++)
{
if('A'<=a[i] && a[i]<='Z')
k=;
else
{
flg=;
break;
}
}
//printf("%d\n",flg);
if(flg!=)
printf("%s\n",a);
else
{
if('A'<=a[] && a[]<='Z')
printf("%c",a[]+);
else
printf("%c",a[]-);
for(i=;i<l;i++)
printf("%c",a[i]+);
}
printf("\n");
}
return ;
}

CodeForces 131A cAPS lOCK的更多相关文章

  1. ubunut 14.04 将Caps Lock设置为Control

    入手了emacs,一直折腾想把caps Lock设置为control键. 网上看到一个用gnome里找到系统-首选项之类可以直接设置的.在14.04版的ub中是找不到的(新版设置太坑,只有那么几个选项 ...

  2. ubuntu 交换ctrl与caps lock 键

    The relevant option is no longer available in the settings menu in Ubuntu 13.10; this has been repor ...

  3. 交换Ctrl和Caps Lock键

    由于使用vim的缘故,就把Ctrl和Caps Lock键交换了,在ubuntu系统下使用系统设置可以很简单地进行全局替换. 在ubuntu下习惯了之后在window下就经常按错...后来决定也把win ...

  4. 转:判断Caps Lock键是否打开,如果打开则关闭

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  5. Mac下常用按键符号⌘(command)、⌥(option)、⇧(shift)、⇪(caps lock)、⌃(control)、↩(return)、⌅(enter)

    常用符号如下: ⌘(command) ⌥(option) ⇧(shift) ⇪(caps lock) ⌃(control) ↩(return) ⌅(enter) 对应键盘的位置如下: 如果每次都不记得 ...

  6. Mac OS 10.12后Caps lock(大写键)无法使用的解决办法

    ▲打开设置中的键盘选项,并切换至输入源选项标签, ▲取消勾选“使用大写锁定键来回切换“美国英文””, ▲这时再按下Caps lock即可正常使用大小写切换. ▲Update:目前macOS 10.12 ...

  7. C - cAPS lOCK

    Problem description wHAT DO WE NEED cAPS LOCK FOR? Caps lock is a computer keyboard key. Pressing it ...

  8. OSX - Mac OS 10.12后Caps lock(大写键)无法使用的解决办法

    我在OSX的虚拟机中安装了windows 7 操作系统,但是发现在win7下,大写键不起作用,通过下面方面搞定了! ▲打开设置中的键盘选项,并切换至输入源选项标签, ▲取消勾选“使用大写锁定键来回切换 ...

  9. codeforces水题100道 第二十六题 Codeforces Beta Round #95 (Div. 2) A. cAPS lOCK (strings)

    题目链接:http://www.codeforces.com/problemset/problem/131/A题意:字符串大小写转换.C++代码: #include <cstdio> #i ...

随机推荐

  1. 夺命雷公狗ThinkPHP项目之----企业网站3之后台栏目页的搭建(百度编辑器的引入)

    我们现在就开始搭建我们的后台栏目页的后台了: 首先创建一个CategoryController.class.php的控制器,让列表页和添加页面显示出来先: 然后就是开始动手修改我们的视图部分了: 我们 ...

  2. scan & ATPG

    Testability用来表征一个manufactured design的quality. 将testability放在ASIC前端来做,成为DFT(Design For Test),用可控(cont ...

  3. Android SDK 安卓失败 提示: “Failed to fetch URL…” 的错误提示

    解决方法: 1.   打开Tools 选择 options  将  第一个复选框勾上.           (尝试一下,如果还是失败,参考2) 2.   打开本地host 文件, 在最后一行添加   ...

  4. 【fedora】制作安装u盘

    找一台安装好linux系统的PC,将下载的LiveCD ISO文件复制到硬盘(这样速度快),查看U盘挂载的位置(用磁盘工具),在终端中使用dd命令: $ sudo dd if=<Live ISO ...

  5. 三层架构与MVC的区别

    我们平时总是将混为一谈,殊不知它俩并不是一个概念.下面我来为大家揭晓我所知道的一些真相. 首先,它俩根本不是一个概念. 三层架构是一个分层式的软件体系架构设计,它可适用于任何一个项目. MVC是一个设 ...

  6. ERR: Call to undefined function openssl_random_pseudo_bytes()

    最近使用TP5/PHP7,总是出现ERR: Call to undefined function index\index\openssl_random_pseudo_bytes(),才发现是php没有 ...

  7. ServiceStack.Redis 之 IRedisTypedClient 04_转

    IRedisTypedClient IRedisTypedClient类相当于IRedicClient的强类型版,其方法与属性大多数与IRedisClient类似. 它支持在Redis中使用Linq查 ...

  8. Centos7下使用ELK(Elasticsearch + Logstash + Kibana)搭建日志集中分析平台

    日志监控和分析在保障业务稳定运行时,起到了很重要的作用,不过一般情况下日志都分散在各个生产服务器,且开发人员无法登陆生产服务器,这时候就需要一个集中式的日志收集装置,对日志中的关键字进行监控,触发异常 ...

  9. java 模拟消息的发送功能

    import java.util.HashMap; import java.util.Iterator; import java.util.Map; /* * 完成消息的发送功能 * 在发送消息之前, ...

  10. JavaScript DOM 编程艺术(第2版)读书笔记 (7)

    动态创建标记 一些传统方法 document.write document.write()方法可以方便快捷的把字符串插入到文档里. 请把以下标记代码保存为一个文件,文件名就用test.html 好了. ...