string reduce problem