Skip to content

Instantly share code, notes, and snippets.

@olaugh
Created February 25, 2009 00:45
Show Gist options
  • Save olaugh/69916 to your computer and use it in GitHub Desktop.
Save olaugh/69916 to your computer and use it in GitHub Desktop.
#include <string>
#include <set>
#include <list>
#include <fstream>
#include <iostream>
using namespace std;
int main() {
set<string> sevens;
list<string> eights;
ifstream input("/home/john/scrabble/twl.txt");
string word;
while (getline(input, word)) {
int length = word.length();
if (length == 7)
sevens.insert(word);
else if ((length == 8) && (word[0] == 'A'))
eights.push_back(word);
}
list<string>::iterator i;
for (i = eights.begin(); i != eights.end(); i++)
if (sevens.count((*i).substr(1)))
cout << *i << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment