Problem
Figure 1. A valid matching of basepair edges in the bonding graph of an RNA string, followed by a diagram of how this bonding will induce the resulting folded RNA.
图1 。RNA串键图中的碱基对边缘的有效匹配,然后是该键将如何诱导所得折叠RNA的示意图。
Figure 2. All 12 possible valid basepair matchings in the bonding graph corresponding to the string s = CGAUGCUAG (including the trivial matching in which no edges are matched.) Courtesy Brian Tjaden.
图2 。绑定图中与字符串s = CGAUGCUAG对应的所有12个可能有效的碱基对匹配(包括无边匹配的琐碎匹配)。由Brian Tjaden提供。
Given an RNA string , we will augment the bonding graph of by adding basepair edges connecting all occurrences of 'U' to all occurrences of 'G' in order to represent possible wobble base pairs.
We say that a matching in the bonding graph for is valid if it is noncrossing (to prevent pseudoknots) and has the property that a basepair edge in the matching cannot connect symbols and unless (to prevent nearby nucleotides from base pairing).
See Figure 1 for an example of a valid matching if we allow wobble base pairs. In this problem, we will wish to count all possible valid matchings in a given bonding graph; see Figure 2 for all possible valid matchings in a small bonding graph, assuming that we allow wobble base pairing.
Given: An RNA string (of length at most 200 bp).
Return: The total number of distinct valid matchings of basepair edges in the bonding graph of . Assume that wobble base pairing is allowed.
给定一个RNA串 中,我们将增加的接合图表的通过添加 将所有“ U”出现与所有“ G”出现连接的碱基对边来表示可能的摆动碱基对。
我们说绑定图中的匹配 如果它是非 交叉的(以防止伪结),并且具有匹配项中的碱基对边不能连接符号的属性,则有效 和 除非 (以防止附近的核苷酸与碱基配对)。
如果允许摆动碱基对,请参见图1所示的有效匹配示例。在这个问题中,我们希望在给定的键合图中计算所有可能的有效匹配。 假设我们允许摆动碱基配对,请参见图2以了解小绑定图中所有可能的有效匹配。
给定: RNA字符串(最大长度为200 bp)。
返回值:的键合图中碱基对边的不同有效匹配的总数。假设允许摆动碱基配对。
Sample Dataset
AUGCUAGUACGGAGCGAGUCUAGCGAGCGAUGUCGUGAGUACUAUAUAUGCGCAUAAGCCACGU
Sample Output
284850219977421