Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #import <Foundation/Foundation.h>
  2.  
  3. int main (int argc, const char * argv[])
  4. {
  5.  
  6.     @autoreleasepool {
  7.        
  8.         // insert code here...
  9.         NSLog(@"Hello, World!");
  10.        
  11.         NSString *nameString = [NSString stringWithContentsOfFile:@"/usr/share/dict/propernames" encoding:NSUTF8StringEncoding error:NULL];
  12.        
  13.         NSArray *names = [nameString componentsSeparatedByString:@"\n"];
  14.        
  15.         NSString *wordString = [NSString stringWithContentsOfFile:@"/usr/share/dict/words" encoding:NSUTF8StringEncoding error:NULL];
  16.        
  17.         NSArray *words = [wordString componentsSeparatedByString:@"\n"];
  18.  
  19.         for (NSString *n in names)
  20.         {          
  21.             for (NSString *w in words)
  22.             {
  23.                 if ([n caseInsensitiveCompare: w] == NSOrderedSame)
  24.                 {
  25.                     if ([n compare: w] == NSOrderedAscending)
  26.                     {
  27.                         NSLog(@"%@ and %@ match", n, w);
  28.                     }
  29.                 }                
  30.             }                      
  31.         }
  32.     }
  33.     return 0;
  34. }
  35.  
  36.  
  37.