CodeForces 131A 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
cAPS
Caps
Lock
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的更多相关文章
- ubunut 14.04 将Caps Lock设置为Control
入手了emacs,一直折腾想把caps Lock设置为control键. 网上看到一个用gnome里找到系统-首选项之类可以直接设置的.在14.04版的ub中是找不到的(新版设置太坑,只有那么几个选项 ...
- ubuntu 交换ctrl与caps lock 键
The relevant option is no longer available in the settings menu in Ubuntu 13.10; this has been repor ...
- 交换Ctrl和Caps Lock键
由于使用vim的缘故,就把Ctrl和Caps Lock键交换了,在ubuntu系统下使用系统设置可以很简单地进行全局替换. 在ubuntu下习惯了之后在window下就经常按错...后来决定也把win ...
- 转:判断Caps Lock键是否打开,如果打开则关闭
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- Mac下常用按键符号⌘(command)、⌥(option)、⇧(shift)、⇪(caps lock)、⌃(control)、↩(return)、⌅(enter)
常用符号如下: ⌘(command) ⌥(option) ⇧(shift) ⇪(caps lock) ⌃(control) ↩(return) ⌅(enter) 对应键盘的位置如下: 如果每次都不记得 ...
- Mac OS 10.12后Caps lock(大写键)无法使用的解决办法
▲打开设置中的键盘选项,并切换至输入源选项标签, ▲取消勾选“使用大写锁定键来回切换“美国英文””, ▲这时再按下Caps lock即可正常使用大小写切换. ▲Update:目前macOS 10.12 ...
- C - cAPS lOCK
Problem description wHAT DO WE NEED cAPS LOCK FOR? Caps lock is a computer keyboard key. Pressing it ...
- OSX - Mac OS 10.12后Caps lock(大写键)无法使用的解决办法
我在OSX的虚拟机中安装了windows 7 操作系统,但是发现在win7下,大写键不起作用,通过下面方面搞定了! ▲打开设置中的键盘选项,并切换至输入源选项标签, ▲取消勾选“使用大写锁定键来回切换 ...
- codeforces水题100道 第二十六题 Codeforces Beta Round #95 (Div. 2) A. cAPS lOCK (strings)
题目链接:http://www.codeforces.com/problemset/problem/131/A题意:字符串大小写转换.C++代码: #include <cstdio> #i ...
随机推荐
- 2.js基础
4.函数 1)函数是一段完成“指定功能”的已经“命名”的代码段 2)函数只有“调用”才能使用到,调用就是通过名称(可以在声明之前,也可以在声明之后) 3)函数名.参数.函数体.返回值(没有返回值的函数 ...
- android 学习随笔二(读写文件)
在android读写文件 RAM:运行内存,相当于电脑的内存 ROM:内部存储空间,相当电脑硬盘,android手机必须有的 SD卡:外部存储空间,相当电脑的移动硬盘,不是必须的.手机如果内置16G存 ...
- history and its relevant variables in Linux/GNU and Mac OS history命令以及相关环境变量
对于Terminalor们,history命令并不陌生,什么!n, !!更是很常用的,而且您在命令行敲的cmds是默认保存在/home/$USER/.bash_history(linux) /User ...
- Linux按键驱动程序设计详解---从简单到不简单【转】
转自:http://blog.csdn.net/coding__madman/article/details/51399353 版权声明:本文为博主原创文章,未经博主允许不得转载. 混杂设备驱动模型: ...
- Perl的基本语法<总结> (转载)
前言:这篇文章是花了我很多时间.费了我很多心血才完成的,虽然连我自己都觉得无法达到尽善尽美的境界,但希望能帮助大家入门,稍微了解到Perl 到底是个什么样的东西,Perl到底有那些强大的功能,那么这篇 ...
- linux乱码
修改系统变量: export LANG=en
- java正则表达式四种常用的处理方式是怎么样呢《匹配、分割、代替、获取》
java 正则表达式高级篇,介绍四种常用的处理方式:匹配.分割.替代.获取,具体内容如下package test; import java.util.regex.Matcher; import jav ...
- 12、Jsp加强/自定义标签/JavaBean
1 Jsp加强回顾 Jsp加强 1)Jsp的9大内置对象 request HttpServletRequet response HttpServletResponse config ...
- class id 区别
[1].id是唯一的,一个元素只能有一个,不能重复class可以重复 <div> <img src="" width="100%"/> ...
- oracle 执行执行动态存储过程名---其实就是存储过程名是个字符串参数
假设我有一个过程P1(V1 IN VARCHAR2),另一有一个过程EX(P IN VARCHAR2,P IN VARCHAR2),第一个参数是过程名,第二个参数是指定过程的参数,我执行EX('P1' ...