[2453일] A. Word Capitalization (성공)

코드포스 공부기록

목록 보기
20/23

A. Word Capitalization
time limit per test2 seconds
memory limit per test256 megabytes
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 exceed 103.

Output
Output the given word after capitalization.

cpp

#include<iostream>
#include<string>
#include<cctype>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	string s;
	cin >> s;
	s[0]= (char)toupper(s[0]);
	cout << s;
	return 0;
}

c#

using System;
using System.IO;
using System.Text;
using System.Threading;
class Program
{
    static BufferedStream sb = new BufferedStream(Console.OpenStandardInput());
    static StreamReader sr = new StreamReader(new BufferedStream(Console.OpenStandardInput()), Encoding.Default);
    static StreamWriter sw = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()), Encoding.Default);
    static int ReadInt()
    {
        int c = sb.ReadByte();
        while (c <= 32) { if (c == -1) return -1; c = sb.ReadByte(); }
        bool neg = false;
        if (c == '-') { neg = true; c = sb.ReadByte(); }
        int val = 0;
        while (c > 32)
        {
            val = val * 10 + (c - '0');
            c = sb.ReadByte();
        }
        return neg ? -val : val;
    }
    static void Solve()
    {
        string s = sr.ReadLine();
        s=char.ToUpper(s[0])+s.Substring(1);
        sw.Write(s);
        sw.Flush();
    }
    static void Main(string[] args)
    {
        Thread thread = new Thread(Solve, 1024 * 1024 * 32);
        thread.Start();
        thread.Join();
    }
}

python3

import sys
input = sys.stdin.readline
s=input().rstrip()
print( s[0].upper()+s [1:]  )

Capitalization is writing a word with its first letter as a capital letter. 이 문장 해석이 잘 안됐음.
capitalization 이 대문자화 라는 말 같고
뒤에 캐피탈 레터 하면 대문자 ..ㅎㄷ;
쉬운문제다.

0개의 댓글