Then, in main
we can use std::transform
to do most of the real work. The main difficulty here is that we need to read the input line-by-line, but transform
uses iterators which (as shown in reverse_line
) normally read word-by-word. There are a number of ways to deal with that, many of which are outlined in answers to an old SO question old SO question.
Then, in main
we can use std::transform
to do most of the real work. The main difficulty here is that we need to read the input line-by-line, but transform
uses iterators which (as shown in reverse_line
) normally read word-by-word. There are a number of ways to deal with that, many of which are outlined in answers to an old SO question.
Then, in main
we can use std::transform
to do most of the real work. The main difficulty here is that we need to read the input line-by-line, but transform
uses iterators which (as shown in reverse_line
) normally read word-by-word. There are a number of ways to deal with that, many of which are outlined in answers to an old SO question.
Note that this appends an extra space at the end of each line. I'd guess that's allowed, but if not you can use an infix_ostream_iterator
infix_ostream_iterator
in place of the ostream_iterator
above.
Note that this appends an extra space at the end of each line. I'd guess that's allowed, but if not you can use an infix_ostream_iterator
in place of the ostream_iterator
above.
Note that this appends an extra space at the end of each line. I'd guess that's allowed, but if not you can use an infix_ostream_iterator
in place of the ostream_iterator
above.
Then, in main
we can use std::transform
to do most of the real work. The The main difficulty here is that we need to read the input line-by-line, but transform
uses iterators which (as shown in reverse_line
) normally read word-by-word. There are a number of ways to deal with that, many of which are outlined in answers to an old SO question.
Then, in main
we can use std::transform
to do most of the real work. The The main difficulty here is that we need to read the input line-by-line, but transform
uses iterators which (as shown in reverse_line
) normally read word-by-word. There are a number of ways to deal with that, many of which are outlined in answers to an old SO question.
Then, in main
we can use std::transform
to do most of the real work. The main difficulty here is that we need to read the input line-by-line, but transform
uses iterators which (as shown in reverse_line
) normally read word-by-word. There are a number of ways to deal with that, many of which are outlined in answers to an old SO question.