#include <algorithm>
#include <iostream>
#include <iterator>
#include <locale>
#include <string>
#include <sstream>
#include <vector>

using namespace std;

int main() {
	const auto temp = ctype<char>::classic_table();
	vector<ctype<char>::mask> bar(temp, temp + ctype<char>::table_size);
	
	bar[' '] ^= ctype_base::space;
	bar['\t'] &= ~(ctype_base::space | ctype_base::cntrl);
	bar[':'] |= ctype_base::space;
	
	istringstream foo("lorem\tipsum\nlorem ipsum:lorem-ipsum");
	
	foo.imbue(locale(cin.getloc(), new ctype<char>(bar.data())));
	
	for_each(istream_iterator<string>(foo), istream_iterator<string>(), [](auto i) { cout << i << endl; } );
	
	return 0;
}