zoukankan      html  css  js  c++  java
  • CF 281A Word Capitalization

    A. Word Capitalization
    time limit per test
    2 seconds
    memory limit per test
    256 megabytes
    input
    standard input
    output
    standard output

    Capitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word.

    Note, that during capitalization all the letters except the first one remains unchanged.

    Input

    A single line contains a non-empty word. This word consists of lowercase and uppercase English letters. The length of the word will not exceed103.

    Output

    Output the given word after capitalization.

    Sample test(s)
    input
    ApPLe
    output
    ApPLe
    input
    konjac
    output
    Konjac

     1 #include <cstdio>
     2 #include <cstring>
     3 using namespace std;
     4 int main(void){
     5   char a[1000+10];
     6   int cnt = 0;
     7   while (~scanf("%s", a)){
     8     {
     9       int len = strlen(a); 
    10         if (a[0] >= 'a' && a[0] <= 'z') printf("%c", a[0]-32);
    11         else printf("%c", a[0]);
    12       for (int i = 1; i < len; ++i){ printf("%c", a[i]);
    13       }
    14       printf("\n");
    15     } cnt++;
    16   }
    17   return 0;
    18 }

    开始题目意思理解错了……WA了一次,这么简单的题目啊……

  • 相关阅读:
    Flask发送邮件
    python 可调用对象之类实例
    flask 跨域请求
    flask登录插件 flask-login
    flask 更新数据库
    python事物管理及同步锁
    Django signals 信号作用及用法说明
    python中各个response使用
    Ntp时间服务器
    Iptables-主机防火墙设置
  • 原文地址:https://www.cnblogs.com/liuxueyang/p/2954601.html
Copyright © 2011-2022 走看看