View Full Version : Matching of two regular expressions.[C++]

10-01-2011, 08:19 PM
"You are given two regular expressions R1 and R2 and should find minimal string S matching both. String consists of capital latin letters A..Z. Regular expression is word consisting of A..Z and * ? symbols. The symbol * corresponds to any word or empty word. The symbol ? corresponds to one letter.

Input Two lines with regular expressions R1 and R2, each line has less than 500 characters.

Output String S — one of the strings with minimal length matching both regular expressions. If string matching R1 and R2 does not exist, then output #."

I'm not quite familiar with regular expressions, and I will be grateful for any help with this task.