P15481 [HackerRank] Incorrect regex
普及-
题目描述

You are given a string $\mbox{S}$.

Your task is to find out whether $\mbox{S}$ is a valid regex or not.

Input Format

The first line contains integer $\mathbf{T}$, the number of test cases.

The next $\mathbf{T}$ lines contains the string $\mbox{S}$.

Constraints

$\textbf{0}<T<100$

Output Format

Print "True" or "False" for each test case without quotes.

Sample Input
2
.+
.
+

Sample Output
True
False

Explanation

.*+ : Valid regex.

.*+: Has the error multiple repeat. Hence, it is invalid.

输入格式

见题面

输出格式

见题面

样例输入
2 .*\+ .*+
样例输出
True False