#include <iostream>
#include <string>
std::string Spaced(std::string userString);
int main()
{
std::cout << "Enter a string: ";
std::string userString;
std::getline(std::cin, userString);
std::string spacedString = Spaced(userString);
std::cout << "
The spaced string is:
" << spacedString << '
';
}
std::string Spaced(std::string userString)
{
std::string spacedString;
for (auto itr : userString)
{
spacedString += itr;
spacedString += ' ';
}
return spacedString;
}