I\'m trying to check if a string is palindrome or not using objective c. I\'m new to programming without any experience in other programming languages so bear with me please
@import Foundation;
BOOL isPalindrome(NSString * str)
{
if (!str || str.length == 0) return NO;
if (str.length == 1) return YES;
for(unsigned i = 0; i < str.length / 2; ++i)
if ([str characterAtIndex:i] != [str characterAtIndex:str.length - i - 1]) return NO;
return YES;
}
int main() {
@autoreleasepool {
NSLog(@"%s", isPalindrome(@"applelppa") ? "YES" : "NO");
} return 0;
}