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了一次,这么简单的题目啊……

  • 相关阅读:
    combobox获取dataset部分数据的方法
    vs2008设置Jquery自动感知方法
    iOS7 初体验
    数据采集[即与 WEB 相关的功能函数]
    javascript 时间倒计时效果
    有进度条圆周率计算
    python科学计算库
    python随笔
    jieba库
    数据分析模块pandas
  • 原文地址:https://www.cnblogs.com/liuxueyang/p/2954601.html
Copyright © 2011-2022 走看看