Having trouble with this challenge


#1

[code]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];
    
    NSArray *words = [wordString componentsSeparatedByString:@"/n"];

    NSString *nameString =
    [NSString stringWithContentsOfFile:@"/usr/share/dict/propernames"
                              encoding:NSUTF8StringEncoding
                                 error:NULL];
    
    NSArray *names = [nameString componentsSeparatedByString:@"/n"];
    
    for (NSString *n in names) {
        NSString *nlc = [n lowercaseString];
        for (NSString *w in words){
            if ([nlc isEqualToString:w]) {
                NSLog(@"%@ is both a name and a word", nlc);
                
            }
        }
    }

}
return 0;

}
[/code]

It is building fine but returning nothing. Also Hi just bought the book and first post on the forum. Im crazy excited to take the plunge with Obj C!


#2

[quote] ... ... = [wordString componentsSeparatedByString:@"/n"]; ... ... = [nameString componentsSeparatedByString:@"/n"]; ... [/quote]
Compare:

...
... = [wordString componentsSeparatedByString:@"\n"];
...
... = [nameString componentsSeparatedByString:@"\n"];
...

[Accelerate your learning and become a competent programmer: pretty-function.org]


#3

Nailed it. Thank you buddy!