Assuming you still use the same code as the last question you might want to consider using the first index you have in your element (it[0]
). You could add this result to a string and print it.
Use:
std::string space = "";
std::string result = "";
auto end = vec.rend();
for(auto it = vec.rbegin(); it != vec.rend(); ++it ) {
if (it == end - 1) {
result += *it;
}
else {
result += it[0];
}
std::cout << space << *it << std::endl;
space += " ";
}
std::cout << result << std::endl;