现在的位置: 首页 > 综合 > 正文

hdoj 2573

2019年07月31日 ⁄ 综合 ⁄ 共 493字 ⁄ 字号 评论关闭

http://acm.hdu.edu.cn/showproblem.php?pid=2573

//字符串
#include <iostream>
#include <string>
using namespace std;

int main()
{
 int t, k;
 bool Caps;
 string str, res;
 cin >> t;
 while (t--) {
  cin >> k;
  Caps = false;
  res.clear();
  while (k--) {
   cin >> str;
   if (str == "Caps") Caps = !Caps;
   if (str.find("Shift") != string::npos) {
    cin >> str;
    Caps = !Caps;
    if (Caps == false) res+=(tolower(str[0]));
    else res+=(toupper(str[0]));
    Caps = !Caps;
    continue;
   }
   if (str.length() == 1) {
    if (Caps == false) res+=(tolower(str[0]));
    else res+=(toupper(str[0]));
   }
  }
  cout << res << endl;
 }
 return 0;
}

 

【上篇】
【下篇】

抱歉!评论已关闭.