[ create a new paste ] login | about

Link: http://codepad.org/j5hhRjs3    [ raw code | output | fork ]

C++, pasted on Dec 25:
#include <string>
#include <algorithm>
#include <locale>
#include <iostream>
#include <iterator>
#include <sstream>

void unique(const std::string& text)
{
	std::stringstream ss(text);

	std::string w;
	while (ss >> w)
	{
		std::string s = w;
		std::sort(s.begin(), s.end());
		if (std::unique(s.begin(), s.end()) == s.end())
			std::cout << w << " ";
	}
}

int main()
{
	setlocale(LC_ALL, "");

	const std::string text = "11 123 1234567 4567894 999 000 01";
	unique(text);

	return 0;
}


Output:
1
123 1234567 01 


Create a new paste based on this one


Comments: