[OCLUG-devel] Matching Strings

Morgan Simpson msimpson at braysimpson.com
Thu Aug 4 14:51:14 PDT 2005


James Colannino wrote:

> My question is, how can I write my program in such a way that these only 
> show up once?  In essence, I'd like it to report:
> 
> albert
> albert
> albany
> 
> Instead of:
> 
> albert
> albert
> albany
> albert
> albany

James, you may want to consider a dictionary construct where each unique 
word is a key and the argument (definition) is the number of times that 
word appears in the input. You traverse the file once to create the 
dictionary. Then you traverse the dictionary and report those words that 
occur more than once.

Best regards,

Morgan Simpson
Bray, Simpson & Associates, Inc.

+1 714 390 5040
+1 714 549 3064


More information about the OCLUG-devel mailing list