zoukankan      html  css  js  c++  java
  • A.Little Sub and Applese

    Description

    ’Why are you always repeating what I say?’ says Applese, a friend of Little Sub.
    ’Because it is the most important quality of mankind.’ says Little Sub.
    Now it is your turn to repeat what Applese says.
    Generally, each sentence Applese says will only contains ’A’..’Z’, ’a’..’z’, ’0’..’9’, space, ’!’ and ’.’.
    Each sentence will definitely end with either ’!’ or ’.’. If it ends with ’.’, change it to ’!’ instead.
    Applese has just passed his 17th birthday, we wish him and his friends very good luck in the future study and programming competitions.

    Input

    There are multiple cases, please read until the end of file.
    Each case will only contain one sentence in one line, indicating what Applese says. The total length of all sentences will not exceed 1000000.

    Output

    Output the answer in one line for each case.

    Author
    YE, Zicheng

    题解:给你一个带空格的字符串,如果结尾是".",改成"!"后输出.
    超级水题.
    #include <iostream>
    #include <cstring>
    const int N=1e6+5;
    using namespace std;
    char s[N];
    int main()
    {
        while(cin.getline(s,N-3)){
          int len=strlen(s);
          if(s[len-1]=='.') s[len-1]='!';
          cout<<s<<endl;
        }
        //cout << "Hello world!" << endl;
        return 0;
    }
    
  • 相关阅读:
    JavaScript对象
    JavaScript基础
    MySQL总结
    前端的基础知识汇总
    反射,面对对象高阶
    django中的认证登陆与用户的创建
    django的cookie和session
    ajax的json包含于xml的区别
    django的分页系统
    django的orm简签
  • 原文地址:https://www.cnblogs.com/-yjun/p/10549878.html
Copyright © 2011-2022 走看看