A word is an anagram if the letters in that word can be re-arranged to form a different word.
The shortest source code by character count to find
#include #include #include #include #define ci const_iterator int main(){using namespace std;typedef string s;typedef vector vs;vs l; copy(istream_iterator(cin),istream_iterator(),back_inserter(l));map r; for (vs::ci i=l.begin(),e=l.end();i!=e;++i){s a=boost::to_lower_copy(*i); sort(a.begin(),a.end());r[a].push_back(*i);}for (map::ci i=r.begin(),e=r.end(); i!=e;++i)if(i->second.size()>1)*copy(i->second.begin(),i->second.end(), ostream_iterator(cout," "))="\n";}