i don’t know why my solution is getting wrong… its a simple catalan problem …dont know where i screwed…plz help

```
def solve(n, k):
if (k > n - k):
k = n - k
res = 1
for i in range(k):
res = res * (n - i)
res = res // (i + 1)
return res
def catalan(n):
c = solve(2*n, n)
return c//(n + 1)
for _ in range(int(input())):
s=input()
l=len(s)
n=l-1
print(catalan(n)%1000000007)
```