Random commentary about Machine Learning, BigData, Spark, Deep Learning, C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search
std::set< char > output;sort( str.begin, str.end() );char prev = str[0];for ( int idx = 1; idx < str.length(); ++idx) { if ( str[idx] == prev ) output.insert(str[idx]); prev = str[idx];}result is in "output"
std::set< char > output;
ReplyDeletesort( str.begin, str.end() );
char prev = str[0];
for ( int idx = 1; idx < str.length(); ++idx) {
if ( str[idx] == prev ) output.insert(str[idx]);
prev = str[idx];
}
result is in "output"