int main(){
	vector<string> input = { "lint", "intl", "inlt", "code", };
	vector<string> in2 = { "tea", "", "eat", "", "tea", "" };
	Solution t;
	auto ret = t.anagrams(input);
	auto ret2 = t.anagrams(in2);
	return 0;
}
Example #2
0
int main(){
	Solution so;
	string s[] = { "c", "c" };
	vector<string> v(s,s+2);
	so.anagrams(v);
	cout << so.myPow(0.00001, -214748364);
	return 0;
}
Example #3
0
int main(){
	Solution so;
	string line;
	while(getline(cin,line)){
		vector<string> words=string2vector<string>(line);
		cout<<vector2string<string>(so.anagrams(words)," ")<<endl;
	}
}
Example #4
0
int main(int argc, char *argv[])
{
    Solution sol;
    vector<string> vs{"and", "dan"};
    vector<string> v = sol.anagrams(vs);
    for (auto s : v)
        cout << s << endl;
    return 0;
}
Example #5
0
int main()
{
  string s[] = {"ate", "and", "dna", "tea", "eat", "endl", "hello", "ehllo"};
  vector<string> str(s, s + 8);
  Solution test;
  vector<string> ret = test.anagrams(str);
  for(int i = 0; i < ret.size(); i++)
    cout << ret[i] << endl;
  return 0;
}
int main(){
	Solution sol;
	string a[] = {"foo", "oof", "bar", "arb", "far", "fds", "ofo"};
	vector<string> strs(a, a + sizeof(a) / sizeof(string));
	vector<string> result = sol.anagrams(strs);
	for(int i = 0 ; i < result.size(); ++ i){
		cout << result[i] << endl;
	}
	return 0;
}
Example #7
0
int main()
{
    Solution s;
    vector<string> ins{"", ""};
    auto res = s.anagrams(ins);
    for (auto & s : res) {
        cout << s << endl;
    }
    return 0;
}
Example #8
0
int main() {
  Solution sol;
  vector<string> strs = {"dog","cat","god","tac"};
  vector<string> anagrams = sol.anagrams(strs);
  copy(anagrams.begin(), anagrams.end(), 
    ostream_iterator<decltype(anagrams)::value_type>(cout, " "));
  cout << '\n';
  
  return 0;
}
Example #9
0
int main()
{
    vector<string> strs = {"tea","and","ate","eat","dan"};
    Solution s;
    vector<string> res;
    res = s.anagrams(strs);
    for(auto iter = res.begin(); iter != res.end(); iter++) {
        cout<<*iter<<" ";
    }
    return 0;
}
Example #10
0
int main(int argc, char * argv[]) {
    vector<string> inputs;
    inputs.push_back("ape");
    inputs.push_back("and");
    inputs.push_back("eap");
    // inputs.push_back("cat");
    Solution solve;
    vector<string> output = solve.anagrams(inputs);
    UIO<string>::pr(output);
    return 0;
}
Example #11
0
int main() {
    const char *A[] = {
        "tea","and","ate","eat","den"
    };
    vector<string> strs(A, A + 6);
    Solution solu = Solution();
    vector<string> res = solu.anagrams(strs);
    for (vector<string>::iterator it = res.begin(); it != res.end(); it++) {
        cout << *it << ", ";
    }
    cout << endl;
}
Example #12
0
int main() {
    vector<string> strs {"tea","and","ate","eat","den"};
    cout << "Input: " << endl;
    for(auto word : strs)
        cout << word << " ";
    cout << endl;
    Solution sol;
    vector<string> result = sol.anagrams(strs);
    cout << "Output: " << endl;
    for(auto word : result)
        cout << word << " ";
    cout << endl;
}
int main(void){
	Solution answer;
	string str[] = { "abc", "acb", "acf" };
	vector<string> strs;
	for (size_t i = 0; i < 3; ++i)
		strs.push_back(str[i]);
	vector<string> ret = answer.anagrams(strs);
	for (size_t i = 0; i < ret.size(); ++i)
		cout << ret[i] << " ";
	cout << endl;
	system("Pause");
	return 0;
}
Example #14
0
void main(int argc, char *argv[]){
	vector<string> strs = { "last", "salt", "diary", "reap", "cook", "dairy", "apple", "pear", "stal", "pea", "ape", "meat" };
	cout << "The original words are: ";
	for (string ss : strs)
		cout << "'" << ss << "' ";
	cout << endl;
	Solution s;
	vector<string> anagramWords = s.anagrams(strs);
	cout << "The anagrams words are: ";
	for (string ss : anagramWords)
		cout << "'" << ss << "' ";
	cout << endl;
	system("pause");
}
Example #15
0
int main()
{
    vector<string> temp;
    temp.push_back("tea");
    temp.push_back("and");
    temp.push_back("ate");
    temp.push_back("eat");
    temp.push_back("den");
    Solution s;
    vector<string> res=s.anagrams(temp);
    for(int i=0;i<res.size();i++)
        cout<<res[i]<<endl;
    return 0;
}
Example #16
0
int main()
{
    Solution s;

    string strin[49] = {"hos","boo","nay","deb","wow","bop","bob","brr","hey","rye","eve","elf","pup","bum","iva","lyx","yap","ugh","hem","rod","aha","nam","gap","yea","doc","pen","job","dis","max","oho","jed","lye","ram","pup","qua","ugh","mir","nap","deb","hog","let","gym","bye","lon","aft","eel","sol","jab"};
    vector<string> vin(strin, strin + 49);
    vector<string> vout = s.anagrams(vin);
    for (vector<string>::iterator i = vout.begin(); i != vout.end(); ++i)
    {
        cout << *i << " ";
    }
    cout << endl;
    system("PAUSE");
    return 0;
}
Example #17
0
int main()
{
	Solution s;
	vector<string> t;
	vector<string> r;
	t.push_back("eat");
	t.push_back("ate");
	t.push_back("and");
	r = s.anagrams(t);
	for (vector<string>::iterator it = r.begin(); it != r.end(); ++it)
	{
		cout << *it << endl;
	}
	return 0;
}
Example #18
0
int main() {
    Solution sln; 
    vector<string> input; 
    input.push_back("mary");
    input.push_back("yram");  
    input.push_back("hello"); 
    
    vector<string> result = sln.anagrams(input); 
    
    for (int i = 0; i < result.size(); i++) {
        cout << result[i] << " "; 
    }
    
    cout << endl; 
    
    return 0; 
}
Example #19
0
int main()
{
	vector<string> strs;
	strs.push_back("abc");
	strs.push_back("cba");
	strs.push_back("abcd");
	strs.push_back("bac");
	strs.push_back("adbc");

	Solution s;
	vector<string> result = s.anagrams(strs);

	for (size_t i = 0; i < result.size(); ++i)
		cout << result[i] << endl;

	system("pause");
	return 0;
}
Example #20
0
int main(int argc, char **argv) {
  std::cout << "------" << argv[0] << "------" << std::endl;

  string arr[] = {"ant", "tan", "nba", "abn", "tna"};
  int sz = sizeof(arr) / sizeof(arr[0]);
  vector<string> vec(arr, arr + sz);

  std::cout << "Input:\n";
  Output(vec);

  Solution s;
  vector<string > vecs = s.anagrams(vec);

  std::cout << "Output:\n";
  Output(vecs);

  return 0;

  return 0;
}
Example #21
0
int main(){
    vector<string> ip;
    string s("tea");
    ip.push_back(s);
    s=string("and");
    ip.push_back(s);
    s=string("ate");
    ip.push_back(s);
    s=string("eat");
    ip.push_back(s);
    s=string("den");
    ip.push_back(s);
    Solution x;
    vector<string> ans = x.anagrams(ip);
    int len = ans.size();
    for(int i=0;i<len;i++){
        printf("%s\n",ans[i].c_str());
    }
    return 0;
}
Example #22
0
int main()
{
    Solution s;
    vector<string> strs,ans;
    int n;
    string con;
    while(cin>>n)
    {
        strs.clear();
        ans.clear();
        getwchar();
        for(int i=0;i<n;i++)
        {
            getline(cin,con);
            strs.push_back(con);
        }

        for(int k=0;k<strs.size();k++) cout<<strs[k]<<endl;
        ans = s.anagrams(strs);
        for(int j=0;j<ans.size();j++) cout<<ans[j]<<" ";
        cout<<endl;
    }
    return 0;
}
Example #23
0
int main(int argc, char *argv[])
{
    Solution s;
    vector<string> v;
    vector<string> ve;
    vector<string> r;

    v.clear();
    v.push_back("lint");
    v.push_back("intl");
    v.push_back("inlt");
    v.push_back("code");
    ve.clear();
    ve.push_back("lint");
    ve.push_back("intl");
    ve.push_back("inlt");
    r = s.anagrams(v);
    assert(ev(r, ve));

    v.clear();
    v.push_back("ab");
    v.push_back("ba");
    v.push_back("cd");
    v.push_back("dc");
    v.push_back("e");
    ve.clear();
    ve.push_back("ab");
    ve.push_back("ba");
    ve.push_back("cd");
    ve.push_back("dc");
    r = s.anagrams(v);
    assert(ev(r, ve));

    v.clear();
    v.push_back("ab");
    v.push_back("bc");
    v.push_back("cd");
    ve.clear();
    r = s.anagrams(v);
    assert(ev(r, ve));

    v.clear();
    v.push_back("");
    v.push_back("");
    v.push_back("ab");
    v.push_back("bc");
    v.push_back("cd");
    ve.clear();
    ve.push_back("");
    ve.push_back("");
    r = s.anagrams(v);
    assert(ev(r, ve));

    v.clear();
    v.push_back("apt");
    v.push_back("man");
    v.push_back("qom");
    v.push_back("apt");
    v.push_back("lei");
    v.push_back("hus");
    v.push_back("pet");
    v.push_back("gay");
    v.push_back("six");
    v.push_back("mai");
    ve.clear();
    ve.push_back("apt");
    ve.push_back("apt");
    r = s.anagrams(v);
    //cout << to_str(v);
    //cout << to_str(r);
    //cout << to_str(ve);
    assert(ev(r, ve));

    v.clear();
    ve.clear();
    r = s.anagrams(v);
    assert(ev(r, ve));
    return 0;
}