Add tags

Add tags to the following comment

LLでないですし、ぜんぜん短くありませんし、多バイト文字のこと考えられてませんが、例示ということで。

標準入力から入力し、標準出力へ出力します。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <cctype>
#include <string>
#include <iostream>
#include <iterator>
#include <algorithm>

std::string capitalize(const std::string& s)
{
    std::string result(s);
    if(result.size() > 0)
    {
        result[0] = std::toupper(result[0]);
    }
    return result;
}

int main(int, char* [])
{
    std::istream_iterator<std::string> srcBegin(std::cin);
    std::istream_iterator<std::string> srcEnd;
    std::ostream_iterator<std::string> dst(std::cout, " ");
    std::transform(srcBegin, srcEnd, dst, capitalize);

    return 0;
}

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...