IBM interview question

Boolean search