Just a quick and dirty solution (didn't rename variable names and so on) for your function
-(void) expand_combinations: (NSString *) remaining_string arg2:(NSString *)s arg3:(int) remain_depth
{
NSString *newString = [remaining_string stringByReplacingCharactersInRange:NSMakeRange(remain_depth, 1) withString:@""];
// NSLog(newString);
if(remain_depth==0)
{
printf("%s\n",[s UTF8String]);
return;
}
[self expand_combinations:remaining_string arg2:s arg3:remain_depth - 1];
return;
}
Output (I used NSLog)
2010-09-26 04:27:26.462 Untitled[5417:207] abc
2010-09-26 04:27:26.462 Untitled[5417:207] abd
2010-09-26 04:27:26.463 Untitled[5417:207] acd
2010-09-26 04:27:26.467 Untitled[5417:207] bcd