[hackerrank] 结构化字符串(解析树)

Generate String from Regex

Authored by abhiranjan on  Jan 10 2014 https://www.hackerrank.com/challenges/regex-to-string-fp

Problem Statement

This is a functional programming challenge in CodeSprint and can only be solved in one of the functional languages.

Regular expressions (abbreviated regex or regexp) are patterns which are used to represent a set of strings. A regex can be represented as a graph with multiple nodes. One of them is start node and another one is final node and characters of regex can serve as a edges.

Sample Input #00

5
ab*(c|d)

Sample Output #00

abbbc

Sample Input #01

6
(a|b|c)(a*|b*)(c|d)

Sample Output #01

cbbbbd

Sample Input #02

10
abc(ab|(pq|(rst)*)*)

Sample Output #02

abcpqrstpq

Sample Input #03

7
a(pq)*d

Sample Output #03

NIL




你可能感兴趣的:([hackerrank] 结构化字符串(解析树))