Question: The "Stopping" statement never gets printed even if you type 'stop' when running the program. Is the `initWithUTF8String:` method introducing extra formatting?

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

    char holderText[256];

    fgets(holderText, 256, stdin);
    NSString *words = [[NSString alloc] initWithUTF8String:holderText];

    if ([words isEqualToString:@"stop"]) {

        NSLog(@"STOPPING");

    }
    NSLog(@"This is what you typed: %@", words);

    [pool drain];
    return 0;
}

```

Answer: 
The code looks fine, even though you're leaking the `words` string. You need to add an `[autorelease]` on the end of that alloc call.

You could try `initWithCString` and also trim new lines and surrounding whitespace.

```
NSString *words = [[[NSString alloc] initWithCString:holderText] autorelease];
words = [words stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];

```
Since `fgets` will probably include a trailing newline, you might want to do a trim of all newlines in the string by using `stringByTrimmingCharactersInSet:`:

```
NSString *trimmed = [words stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];

if([trimmed isEqualToString:@"stop"]]) {
  //...
}

```