My solution for the 2nd challenge


#1

I’m not sure if this code is correct, but since there is no place to find a solution for this challenge yet, I’ll be posting mine. Cheers!

[code]#import <Foundation/Foundation.h>

// I need to define those as global variables to work with them outside of the for loops
NSString *properNameGlen;
NSString *regularWordsGlen;

// I dedicate this work to the bad weather, which made me stay inside all day when it was supposed to be summer

int main (int argc, const char * argv[])
{

@autoreleasepool {
    
    // Read in a file as a huge string (ignoring the possibility of an error)
    NSString *nameString = [NSString stringWithContentsOfFile:@"/usr/share/dict/propernames"
                                                     encoding:NSUTF8StringEncoding error:NULL];
    // Break it into an array of strings
    NSArray *names = [nameString componentsSeparatedByString:@"\n"];
    
    // Go through the array one string at a time
    for (NSString *n in names) {
        
        // Look for the string "Glen" in case-insensitive manner
        NSRange r = [n rangeOfString:@"Glen"options:NSCaseInsensitiveSearch];
        
        // Was it found ?
        if (r.location != NSNotFound) {
            NSLog(@"%@", n);
            properNameGlen = n; // will be compared later
        }
    }
    
    // Looking for the found string "GLEN" in the file with regular words
    // repeating the steps from above for the other file
    NSString *wordString = [NSString stringWithContentsOfFile:@"/usr/share/dict/words"
                                                     encoding:NSUTF8StringEncoding error:NULL];
    
    NSArray *words = [wordString componentsSeparatedByString:@"\n"];
    
    for (NSString *w in words) {
        NSRange r2 = [w rangeOfString:@"glen"options:NSCaseInsensitiveSearch];
        
        if (r2.location != NSNotFound) {
            NSLog(@"%@", w);
            regularWordsGlen = w;
        }
    }
    
    // Comparing the two strings
    
    if ([properNameGlen caseInsensitiveCompare:regularWordsGlen] == NSOrderedSame) {
        NSLog(@"The name Glen and the word glen are equal.");
    }
}
return 0;

}

[/code]


#2

I wanted to try finding all matches between the Proper Names and Words lists, and came up with the following. This was my first time experimenting with blocks, which are introduced later in the book.

#import <Foundation/Foundation.h>

int main(int argc, const char *argv[]) {
  NSAutoreleasePool *pool = [NSAutoreleasePool new];
  
  // Capture the contents of both the proper names and word lists
  NSString *nameString = [NSString 
    stringWithContentsOfFile:@"/usr/share/dict/propernames"
    encoding:NSUTF8StringEncoding
    error:NULL];
  NSString *wordString = [NSString
    stringWithContentsOfFile:@"/usr/share/dict/words"
    encoding:NSUTF8StringEncoding
    error:NULL];
  
  // Convert each list into arrays
  NSArray *names = [nameString componentsSeparatedByString:@"\n"];
  NSArray *words = [wordString componentsSeparatedByString:@"\n"];

  // Create a reference to a mutable (can-be-changed) array, in which we'll store matches
  NSMutableArray *matches = [[NSMutableArray alloc] init];
  
  // Loop through the names array. Search the words array for each name. If a case-insensitive match
  // is found, store its index in an NSIndexSet called indexes
  for (NSString *n in names) {
    NSIndexSet *indexes = [words 
      indexesOfObjectsPassingTest:^(id obj, NSUInteger idx, BOOL*stop) {
        NSString *word = (NSString *)obj;
        if ([n caseInsensitiveCompare:word] == NSOrderedSame) {
          return YES;
        }
        return NO;
      }
    ];
    
    // If the index set is not empty, store a string in the matches array
    if ([indexes count] > 0) {
      [indexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
        NSString *tempString = [NSString stringWithFormat:@"%@ and %@", n, [words objectAtIndex:idx]];
        [matches addObject:tempString];
        tempString = nil;
      }];
    }
  }
  
  // Store the matches array to a file
  NSString *filePath = @"names.txt";
  [matches writeToFile:filePath atomically:YES];

  [pool drain];
  return 0;
}

#3

Here’s my very bare-bones solution to the problem. After creating arrays to hold both the names and the words, create a loop nested within a loop. In plain English, what it’s doing is going through the list of names, and for each name, it checks to see if that name is also in the words array.

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{

	@autoreleasepool {
		// create an array that holds all the names
		NSString *namesString = [NSString stringWithContentsOfFile:@"/usr/share/dict/propernames"
														  encoding:NSUTF8StringEncoding
															 error:NULL];
		NSArray *names = [namesString componentsSeparatedByString:@"\n"];
		
		// create an array that holds all of the words
		NSString *wordsString = [NSString stringWithContentsOfFile:@"/usr/share/dict/words"
														  encoding:NSUTF8StringEncoding
															 error:NULL];
		NSArray *words = [wordsString componentsSeparatedByString:@"\n"];
		
		// now, for each name, check to see if there's a case-insensitive match in the words array
		for (NSString *name in names)
		{
			// check to see if it matches a word in 
			for (NSString *word in words)
			{
				if ([name caseInsensitiveCompare:word] == NSOrderedSame)
				{
					NSLog(@"%@ and %@ are equal!", name, word);
					break; // we can exit this loop and return to the outer loop since we found a match
				}
			}
		}
	}
    return 0;
}

This works. But there’s a catch: In 10.7.2, the words list contains all of the names in the propernames list! So every name matches! I don’t know if this is a recent change to OS X, but it somehow seemed to slip by the authors/editors.

Erik


#4

I had the same problem. The words list also contains the list of names in my computer. What I realized is that whenever a name was also a regular word it was repeated twice contiguously on the words list so taking into account this advantage here’s the code I came up with to solve the challenge:

//
//  main.m
//  28NamesAndRegularWords
//
//  Created by Hector Sanchez on 10/18/11.
//  Copyright 2011 __Heimlich Counter-Maneuver__. All rights reserved.
//

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    // Read proper names and regular words files
    NSString *nameString = [NSString stringWithContentsOfFile:@"/usr/share/dict/propernames"
                                                     encoding:NSUTF8StringEncoding
                                                        error:NULL];
    NSString *wordString = [NSString stringWithContentsOfFile:@"/usr/share/dict/words" 
                                                     encoding:NSUTF8StringEncoding 
                                                        error:NULL];
    
    //Separate into different strings in arrays
    NSArray *nameArray = [nameString componentsSeparatedByString:@"\n"];
    NSArray *wordArray = [wordString componentsSeparatedByString:@"\n"];
    
    //Cycle through every name
    for (int b=0; b<[nameArray count]; b++) 
    {
        //Cycle trough every word except the last one (this due to the fact that names that are also common words are repeated twice consecutively in the words list so if the last word is not repeated twice it is not a name and we are not interested in it)
        for (int a=0; a<[wordArray count]-1; a++) 
        {
            //When the name is found in the words dictionary it is marked as a potential match
            if (![[wordArray objectAtIndex:a] caseInsensitiveCompare:[nameArray objectAtIndex:b]]) 
            {
                //If the name appears twice consecutively in the words list it is also a name
                if(![[wordArray objectAtIndex:(a+1)] caseInsensitiveCompare:[nameArray objectAtIndex:b]])
                {
                    NSLog(@"%@",[wordArray objectAtIndex:a]);
                }
            }
        }
    }
    
    
  
    [pool drain];
    return 0;
}

It may be a little rough but it solves the task in a simple way.
gl hf :wink:


#5

This is a great solution to a flawed exercise. I’m sorry about that.


#6

Don’t worry. It is a great book and I am having much fun with it. Looking forward to the 4th edition of Cocoa Programming for MacOs X :slight_smile:

A friend of mine (Danton Canut) came up with another solution, he compared the name with the word with caseInsensitiveCompare and if it was equal then compared the string and if they were not equal it meant that it was a regular word and not a name.
Here’s his code posted with his permission.

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{

   NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

   NSString *nameString =[NSString stringWithContentsOfFile:@"/usr/share/dict/propernames" encoding:NSUTF8StringEncoding error:NULL];
   NSString *palabrasString =[NSString stringWithContentsOfFile:@"/usr/share/dict/words" encoding:NSUTF8StringEncoding error:NULL];
   NSArray *names= [nameString componentsSeparatedByString:@"\n"];
   NSArray *palabras=[palabrasString componentsSeparatedByString:@"\n"];
   //NSMutableArray *nombresYPalabras=[NSMutableArray array];
   for(NSString *p in palabras){
       for(NSString *n in names){
           //NSRange r = [p rangeOfString:n options:NSCaseInsensitiveSearch];
           if([n caseInsensitiveCompare:p]==NSOrderedSame)
           {
               if(![n isEqualToString:p])
               NSLog(@"%@=%@",n,p);
           }
       }
   }
   
   
   [pool drain];
   return 0;
}

#7

Great book. Here’s my solution to the challenge. It seems I read the challenge differently than others.

[code]#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{
@autoreleasepool {

    // Read in a file as a huge string (ignoring the possibility of an error)
    NSString *wordString = [NSString stringWithContentsOfFile:@"/usr/share/dict/words"
                                                     encoding:NSUTF8StringEncoding 
                                                        error:NULL];
    // Break it into an array of strings
    NSArray *word = [wordString componentsSeparatedByString:@"\n"];
    
    // Go through the array one string at a time 
    for (int i = 1; i < [word count] -1; i++) {

            NSString *a = [word objectAtIndex:i-1];
            NSString *b = [word objectAtIndex:i];
            if ([a caseInsensitiveCompare:b] == NSOrderedSame) {
                NSLog(@"%@ : %@\n", a, b);
            }
    }
}
return 0;

}
[/code]


#8

Because of the problems with the words file including the Proper Names as well now (apparently…)
I decided to try a different elimination idea, but then I discovered that the word file still has all the lowercase names as well.

int main (int argc, const char * argv[])
{

    @autoreleasepool {
        
   
        NSString *nameString = 
            [NSString stringWithContentsOfFile:@"/usr/share/dict/propernames" encoding:NSUTF8StringEncoding error:NULL];
        NSString *wordString =
            [NSString stringWithContentsOfFile:@"/usr/share/dict/words" encoding:NSUTF8StringEncoding error:NULL];
        
        // Break it into an array of strings
        NSArray *names = [nameString componentsSeparatedByString:@"\n"];
        NSArray *words = [wordString componentsSeparatedByString:@"\n"];
        
        // Go through the array one string at a time
        for (NSString *name in names){
            
            // For Challenge 15, for every name compare against every word for equality in a case insensitive manner
  
            for (NSString *word in words){
                if (word){       // this next comparison removes the exact matches so you only have hits if the words match but in a case-insensitive way
                    if (([word caseInsensitiveCompare:name] == NSOrderedSame) && (![word isEqualToString:name])){
                        NSLog(@"The name %@ is the same as the word %@",name,word);
                    }
                }
                
            } 
        }
    }
    return 0;
}

Then I get this as a sample of output, which is what I think the challenge was essentially looking for, with the exception that I didn’t think they thought all the lowercase names were in the words file now. I get 294 matches this way.

2011-11-09 13:53:52.452 AdjacentAs[831:707] The name Will is the same as the word will
2011-11-09 13:53:52.540 AdjacentAs[831:707] The name Willie is the same as the word willie
2011-11-09 13:53:52.598 AdjacentAs[831:707] The name Win is the same as the word win
2011-11-09 13:53:52.650 AdjacentAs[831:707] The name Wolf is the same as the word wolf
2011-11-09 13:53:52.688 AdjacentAs[831:707] The name Woody is the same as the word woody

#9

Ahh!

I finally broke down and came here in frustration to figure out why my code wasn’t working only to find that the words file contains all the names as well. In any case here was my code, now I’ll play around with it more like others have. :laughing:

[code]#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{

@autoreleasepool {
    
// Read in the strings. Forget error handling for now
    NSString *nameString = [NSString stringWithContentsOfFile:@"/usr/share/dict/propernames" 
                                                     encoding:NSUTF8StringEncoding
                                                        error:NULL];
    
    NSString *wordsString = [NSString stringWithContentsOfFile:@"/usr/share/dict/words"
                                                      encoding:NSUTF8StringEncoding
                                                         error:NULL];
    
    // Break the strings into arrays
    NSArray *names = [nameString componentsSeparatedByString:@"\n"];
    NSArray *words = [wordsString componentsSeparatedByString:@"\n"];
    
    // Compare our arrays of strings
    for (NSString *n in names) {
        
        for (NSString *w in words) {
            if ([n caseInsensitiveCompare:w] == NSOrderedSame) {
                NSLog(@"Found %@ and %@", n, w);
            }
        }
    
    }
}
return 0;

}[/code]


#10

I found that the words which are both proper nouns and ordinary words are in the words list in both a capitalised and entirely lower case form. The words which are only proper nouns and not ordinary words, do no appear in the words list in lower case form. Thus converting the proper noun to lower case before performing a case sensitive search in the words list did the trick.

[code]int main (int argc, const char * argv[])
{

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

// Read the file of proper nouns into an array
NSString *properNounsString = [NSString stringWithContentsOfFile:@"/usr/share/dict/propernames"
                                                       encoding:NSUTF8StringEncoding
                                                          error:NULL];
NSArray *properNouns = [properNounsString componentsSeparatedByString:@"\n"];

// Read in the file of words into an array
NSString *wordsString = [NSString stringWithContentsOfFile:@"/usr/share/dict/words"
                                                        encoding:NSUTF8StringEncoding
                                                           error:NULL];
NSArray *words = [wordsString componentsSeparatedByString:@"\n"];

// Run through array of proper nouns
for(NSString *properNoun in properNouns)
{
    // Run through the array of words
    for(NSString *word in words)
    {
        if([[properNoun lowercaseString] isEqualToString:word])
        {
            NSLog(@"%@", properNoun);
            break;
        }
    }
}

[pool drain];
return 0;

}[/code]

This seems to be a very processor intensive activity though, and for some reason my program continued to run for a long time after it had finished searching for words. I suspect that this is because the garbage collector had a lot of work to do cleaning up after me! :slight_smile:


#11

Chapter 16 pushed me into read the documentation for NSArray and NSString.
NSArray’s containsObject: method does a string comparison (rather than an ‘exactly equal to’ test) when used with NSString objects (using NSString’s isEqualToString: method I presume).

This allows for a more efficient solution to the challenge:

[code]int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

// Read the file of proper nouns into an array
NSString *properNounsString = [NSString stringWithContentsOfFile:@"/usr/share/dict/propernames"
                                                       encoding:NSUTF8StringEncoding
                                                          error:NULL];
NSArray *properNouns = [properNounsString componentsSeparatedByString:@"\n"];

// Read in the file of words into an array
NSString *wordsString = [NSString stringWithContentsOfFile:@"/usr/share/dict/words"
                                                        encoding:NSUTF8StringEncoding
                                                           error:NULL];
NSArray *words = [wordsString componentsSeparatedByString:@"\n"];

// Run through array of proper nouns
for(NSString *properNoun in properNouns)
{
    // See if the words array contains the *lower case* version of the proper noun
    if([words containsObject:[properNoun lowercaseString]])
    {
        // Yes. The proper noun must also be an ordinary word
        NSLog(@"%@", properNoun);
    }
}

[pool drain];
return 0;

}[/code]


#12

ARC FTW! :smiley:


#13

Another random conspiracy?

More to the point, I suspect I’ve figured out the reason for my performance issue. I’ve been using Xcode 4.1, not 4.2. Automatic reference counting and the @autoreleasepool syntax weren’t introduced until Xcode 4.2. Without these, none of my objects would be deallocated automatically (and I wasn’t releasing them), so I basically had a huge memory leak.

So a word to the wise for anybody else working through this book - make sure you’re using at least Xcode 4.2. If you’re not, then it will be necessary to do reference counting yourself (covered on pages 131 & 132 “For the more curious: Manual reference counting and ARC History”)


#14

Here is another take on the problem, but instead of using the method “isEqualToString”, the “compare” method is used.

The key logic:

if (([properName caseInsensitiveCompare:word] == NSOrderedSame) && !([properName compare:word] == NSOrderedSame)) {
    NSLog(@"Found match: %@ and %@", properName, word);
}

The full code:

    NSString *fileProperNamesAsString = [NSString stringWithContentsOfFile:@"/usr/share/dict/propernames" 
                                                       encoding:NSUTF8StringEncoding 
                                                          error:NULL];
    NSArray *properNames = [fileProperNamesAsString componentsSeparatedByString:@"\n"];

    NSString *fileWordsAsString = [NSString stringWithContentsOfFile:@"/usr/share/dict/words" 
                                                                  encoding:NSUTF8StringEncoding 
                                                                     error:NULL];
    NSArray *words = [fileWordsAsString componentsSeparatedByString:@"\n"];
    
    for (NSString *properName in properNames) {
        for (NSString *word in words) {
            if (([properName caseInsensitiveCompare:word] == NSOrderedSame) && !([properName compare:word] == NSOrderedSame)) {
                NSLog(@"Found match: %@ and %@", properName, word);
            }
        }
    }

#15

Yet another solution from a different angle. :slight_smile:

Approach here is to filter out all proper names from the word list prior to attempting a case insensitive match against the name list. Filtering is based on the first letter being a capital.

[code]#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{

@autoreleasepool {
    
    NSString *nameList = [NSString stringWithContentsOfFile:@"/usr/share/dict/propernames"
                                                   encoding:NSUTF8StringEncoding
                                                      error:NULL];

    NSString *wordList = [NSString stringWithContentsOfFile:@"/usr/share/dict/words"
                                                   encoding:NSUTF8StringEncoding
                                                      error:NULL];
    
    NSArray *names = [nameList componentsSeparatedByString:@"\n"];
    NSArray *words = [wordList componentsSeparatedByString:@"\n"];
    
    // create a set of upper case characters
    NSCharacterSet *charSet = [NSCharacterSet uppercaseLetterCharacterSet];
    
    for (NSString *word in words) {

        // treating all words starting with a capital as a proper name
        // next word if string is empty or the first character is a capital
        if ([word length] == 0 || [charSet characterIsMember:[word characterAtIndex:0]])
            continue;

        for (NSString *name in names) {
            
            // compare all names against each word
            if ([word caseInsensitiveCompare:name] == NSOrderedSame) {
                
                // if a match occurs print result and break out of the inner loop
                NSLog(@"Match Found - word: %@, name: %@", word, name);
                break;
            }
        }
    }
}

return 0;

}
[/code]


#16

This is a little more efficient, going through both arrays at the same time, only once.

#import <Foundation/Foundation.h>

NSArray * getSortedList(NSString * fileName);

NSArray * getSortedList(NSString * fileName)
{
    NSString *str = [NSString stringWithContentsOfFile:fileName encoding:NSUTF8StringEncoding error:nil];
    NSArray *arr = [str componentsSeparatedByString:@"\n"];
    // I think the words and names are already sorted... so this next line is probably unnecessary
    arr = [arr sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
    return arr;
}

int main (int argc, const char * argv[])
{
    @autoreleasepool {
        NSArray *names = getSortedList(@"/usr/share/dict/propernames");
        NSArray *words = getSortedList(@"/usr/share/dict/words");

        long nameCount = [names count];
        long wordCount = [words count];
        int nameIdx = 0;
        int wordIdx = 0;
        
        // When we reach the end of either list, we're done
        while (nameIdx < nameCount && wordIdx < wordCount)
        {
            NSString *name = [names objectAtIndex:nameIdx];
            NSString *word = [words objectAtIndex:wordIdx];
            
            switch ([name caseInsensitiveCompare:word])
            {
                case NSOrderedSame:
                    // They're the same.
                    // For names that are also regular words, there will be 2 entries in "words" file.
                    // NOTE: names are capitalized and regular words aren't... which would be possible to exploit.  But didn't do that here.
                    if((wordIdx+1 < wordCount) && [word caseInsensitiveCompare:[words objectAtIndex:wordIdx+1]] == NSOrderedSame)
                    {
                        wordIdx++;
                        NSLog(@"%@", name);
                    }
                    
                    nameIdx++;
                    wordIdx++;
                    break;
                case NSOrderedAscending:
                    // Current name is alphabetically less than current word.  advance name index
                    NSLog(@"Sanity check FAIL!  Name %@ was not in word list", name);
                    nameIdx++;
                    break;
                case NSOrderedDescending:
                    // Current Word is alphabetically less than current name.  advance word index
                    wordIdx++;
                    break;
            }
            
        }
    }
    return 0;
}

#17

Very nice, BigNerdWes.

I ran some tests.

Simple way: 275603865 string comparisons, 29 seconds
Complex way: 235954 string comparisons, 1 second

That’s nearly 1200 times more efficient. Not bad!

(To clarify, I compared against cloughinho’s solution, which itself was an optimization.)


#18

In the solution virtualapps posted above, would this:

be the same as this:

Note move of “!”. It works as expected in code, but I’m wondering what the difference is, if any, and how I would say it in english.

This was a great, challenging, exercise - especially since I didn’t give up too quickly to come here and find the solution. I had it right an hour ago (save for the file overlap change), but it was worth the brain stretch to think it through a dozen different ways.


#19

[quote=“myacavone”]In the solution virtualapps posted above, would this:

be the same as this:

Note move of “!”. It works as expected in code, but I’m wondering what the difference is, if any, and how I would say it in english.

This was a great, challenging, exercise - especially since I didn’t give up too quickly to come here and find the solution. I had it right an hour ago (save for the file overlap change), but it was worth the brain stretch to think it through a dozen different ways.[/quote]

Both are equivalent.

in english:
if NOT (N EQUALS w)
is the same as
if (N DOES NOT EQUAL W)

I wouldn’t be surprised if, after compiler optimizations are finished, the same machine code is output.


#20

I had problems with the NSRange to I did the test with a BOOL
I’m wondering if you can do code like this. It runs and the cpu fan is not complaining.

#import <Foundation/Foundation.h>
NSString *processWord(NSString *lookupPath, NSString *myName );
BOOL isFound(NSString *theList, NSString *theName);

/* Functions */
BOOL isFound(NSString *theList, NSString *theName)
{
    BOOL isFound = false;
    if ([theList caseInsensitiveCompare:theName]== NSOrderedSame) {
        isFound = true;
        //NSLog(@"BOOL is true");
    }// end if
    return isFound;
}// end BOOL

NSString *processWord(NSString *lookupPath, NSString *myName )
{
    // Read in a file as a huge string (ignoring the possibility of an error)
    NSString *wordString = [NSString stringWithContentsOfFile:lookupPath encoding:NSUTF8StringEncoding error:NULL];
    
    // Break it into an array of strings
    NSArray *names = [wordString componentsSeparatedByString:@"\n"];

    NSString *foundName = nil;
    
    // Go through the array one string at a time
    for (NSString *n in names) {
        if (isFound(n,myName)){
            //NSLog(@"Found => %@",n);
            foundName = n;
        } // end if (isFound(n,myName)
       
        if (foundName == nil) {
            foundName = @"not found";
        }// end (foundName == nil)
        
    }// end for (NSString *n in names)

    return foundName;
}// end processWord

/* Start main */
int main (int argc, const char * argv[])
{

    @autoreleasepool {
        
        // set the path names
        NSString *_propernames = @"/usr/share/dict/propernames";
        NSString *_words = @"/usr/share/dict/words";
        
        // set the word
        NSString *a = @"Aaron";
        NSString *b = @"glen";
        
        //Process propernames and words
        NSString *_foundName = processWord(_propernames, a);
        NSString *_foundWord = processWord(_words, b);
                
        if([_foundName caseInsensitiveCompare:_foundWord] == NSOrderedSame){
            NSLog(@"The name \"%@\" and the word \"%@\" are equal.",_foundName,_foundWord);
        }// end if
        if([_foundName caseInsensitiveCompare:_foundWord] == NSOrderedAscending){
            NSLog(@"The name \"%@\" comes before the word \"%@\".",_foundName,_foundWord);
        }// end if
        if([_foundName caseInsensitiveCompare:_foundWord] == NSOrderedDescending){
            NSLog(@"The word \"%@\" comes before the name \"%@\".",_foundWord,_foundName);
        }// end if
        
    }// end autoreleasepool
    printf("Thank you, Bye.\n");
    return 0;
}// end main