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

hdoj1048

2019年08月01日 ⁄ 综合 ⁄ 共 419字 ⁄ 字号 评论关闭

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

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

int main()
{
 char oper[11];
 char str[255];
 int i, j;
 while (scanf("%s%*c", oper)) {
  if (strcmp(oper,"START") == 0) {
   gets(str);
   if (strcmp(str,"END") == 0) continue;
   else {
    for (i = 0; i <(int) strlen(str); i++) {
     if (isalpha(str[i])) {
      j = str[i] - 'A';
      str[i] = ((j >= 5) ? 'A'+j-5 : 'A'+26+j-5);
     }
    }
   }
   cout << str << endl;
  }
  if (strcmp(oper,"ENDOFINPUT") == 0)
   break;
 }
 return 0;
}

 

【上篇】
【下篇】

抱歉!评论已关闭.