#import int main(int argc, const char * argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; int n; scanf("%i",&n); char* password_temp = (char *)malloc(n * sizeof(char)); scanf("%s",password_temp); NSString* password = [NSString stringWithFormat:@"%s", password_temp]; /* NSString *numbers = @"0123456789"; NSString *lower_case = @"abcdefghijklmnopqrstuvwxyz"; NSString *upper_case = @"ABCDEFGHIJKLMNOPQRSTUVWXYZ"; NSString *special_characters = @"!@#$%^&*()-+"; */ NSCharacterSet *set = [NSCharacterSet decimalDigitCharacterSet]; BOOL needNumber = ([password rangeOfCharacterFromSet:set].location == NSNotFound); NSCharacterSet *set2 = [NSCharacterSet characterSetWithCharactersInString: @"abcdefghijklmnopqrstuvwxyz"]; BOOL needLowerCase = ([password rangeOfCharacterFromSet:set2].location == NSNotFound); NSCharacterSet *set3 = [NSCharacterSet characterSetWithCharactersInString: @"ABCDEFGHIJKLMNOPQRSTUVWXYZ"]; BOOL needUpperCase = ([password rangeOfCharacterFromSet:set3].location == NSNotFound); NSCharacterSet *set4 = [NSCharacterSet characterSetWithCharactersInString: @"!@#$%^&*()-+"]; BOOL needSpecial = ([password rangeOfCharacterFromSet:set4].location == NSNotFound); NSUInteger count = 0; if (needNumber) { count++; } if (needLowerCase) { count++; } if (needUpperCase) { count++; } if (needSpecial) { count++; } if (n < 6 - count) { count = 6 - n; } printf("%li\n", count); [pool drain]; return 0; }