Seems like it should work - Challenge Part 2


Here’s the code I have for challenge part 2.

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

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

@autoreleasepool {
    // Read in the proper names file
    NSString *properNamesFile = [NSString stringWithContentsOfFile:@"/usr/share/dict/propernames"

    // Read in the words file
    NSString *wordsFile = [NSString stringWithContentsOfFile:@"/usr/share/dict/words"
    // Break the files into two arrays of strings
    NSArray *properNames = [properNamesFile componentsSeparatedByString:@"\n"];
    NSArray *words = [wordsFile componentsSeparatedByString:@"\n"];
    for (NSString *name in properNames) {
        for (NSString *word in words) {
            if ([name caseInsensitiveCompare:word] == NSOrderedSame) {
                NSLog(@"Word %@ and Name %@ are equal", word, name);
return 0;


Seems like this should work fine, but it doesn’t. Any suggestions?

Thank you


I have it figured out that all the names appear in words list which is why they all match between the two files.

Is the challenge really just to take the words file and compare one word to the next until it finds two words the same? That was my original plan but so many answers on here were loading in both files.