Problem 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.

Examples

Input

cAPS

Output

Caps

Input

Lock

Output

Lock
解题思路:题目的意思就是给定的字符串如果有这两种情况:①:所有字符都为大写字母;②:除了第一个是小写字母以外,其余都是大写字母,如果满足其中任意一种情况,就修改整个字符串(大写变小写,小写变大写),否则直接输出原字符串,简单水过!
AC代码:
 #include<bits/stdc++.h>
using namespace std;
int main(){
char s[];bool flag;
cin>>s;
if(s[]>='A' && s[]<='Z'){
flag=true;
for(int i=;s[i]!='\0';++i)
if(s[i]>='a' && s[i]<='z'){flag=false;break;}
if(flag)for(int i=;s[i]!='\0';++i)s[i]+=;
}else{
flag=true;
for(int i=;s[i]!='\0';++i)
if(s[i]>='a' && s[i]<='z'){flag=false;break;}
if(flag){
s[]-=;
for(int i=;s[i]!='\0';++i)s[i]+=;
}
}
cout<<s<<endl;
return ;
}
 

C - cAPS lOCK的更多相关文章

  1. ubunut 14.04 将Caps Lock设置为Control

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

  2. CodeForces 131A cAPS lOCK

    cAPS lOCK Time Limit:500MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit St ...

  3. ubuntu 交换ctrl与caps lock 键

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

  4. 交换Ctrl和Caps Lock键

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

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

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

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

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

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

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

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

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

  9. 交换左Ctrl键和Caps lock键

    Windows 10 Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control ...

随机推荐

  1. vino-server服务是啥服务

    近期接手一个项目,开始梳理服务器,突然发现有个进程是开启5900远程桌面端口的, 在不知情的情况下怕被人给利用了,啥也不说,先干掉再说. server端开启vino-server,允许别人查看自己的桌 ...

  2. python tkinter模块 创建窗口V1.2

    先上图 代码如下 #-*-coding:utf-8-*- import os from tkinter import * root=Tk() root.title('执行窗口') "&quo ...

  3. 18清明校内测试T2

    一道数论好题(math) Time Limit:1000ms   Memory Limit:128MB 题目描述 rsy最近在研究欧几里得算法,不会的同学可以去看下课件以及代码…… 现在她想到了一个新 ...

  4. PostgreSQL使用总结

    最近项目用到了PostgreSQL数据库,网上一堆教程,这里自己整理一下做个笔记: 1,下载安装,我这边安装在Windows7,在这里找到大象一样的标志: 2,双击打开,这里的话按流程直接走: 3,这 ...

  5. 渗透实战(周二):FLUXION暴力破解WIFI登录口令

    Wi-Fi攻与防 假设我们Kali Linux 攻击机有一个无线网卡,想通过特殊手段连入名称:414的Wi-Fi网络,那以下便是特殊手段的具体过程. Wi-Fi的破解 硬件:MacBook Pro.小 ...

  6. dubbo服务telnet命令的使用

    转自:https://www.cnblogs.com/feiqihang/p/4387330.html dubbo服务发布之后,我们可以利用telnet命令进行调试.管理.Dubbo2.0.5以上版本 ...

  7. [HDU3518]Boring counting(后缀数组)

    传送门 求出现超过1次的不重叠子串的个数 根据论文中的方法. 枚举子串的长度 k. 用 k 给 height 数组分组,每一组求解,看看当前组的位置最靠后的后缀和位置最靠前的后缀所差个数是否大于长度, ...

  8. hdu 1273最大流

    #include<stdio.h> #include<string.h> #define inf 1000000000 #include<queue> #defin ...

  9. natural join 以及 v$statname , v$sessstat

    oracle natural join是一个比较方便的用法.如果两个表的某些字段名称相同,类型相同,natural join就会把他们做等值连接.比如下面我们知道这两个视图的结构如下: SQL> ...

  10. 前台JSON字符串,spring mvc controller也接收字符串

    前台JSON字符串,spring mvc controller也接收字符串 前台: $.post(url, { data : JSON.stringify(obj) }, function(data) ...