Count distinct sub sequence wrong ans


i dont know why my code showing wrong ans ?
please tell me why my solution is wrong ??

problem ->
Given a string, count the number of distinct subsequences of it ( including empty subsequence ). For the uninformed, A subsequence of a string is a new string which is formed from the original string by deleting some of the characters without disturbing the relative positions of the remaining characters. For example, “AGH” is a subsequence of “ABCDEFGH” while “AHG” is not.

Input Format
First line of input contains an integer ‘t’ denoting number of test cases. Each of next t lines contains a string s.

Constraints
1<=t<=100 1<=length of s<=100000 s will contain upper letters only.

Output Format
For each test case print ans%1000000007 where ans is the number of distinct subsequences.

Sample Input
2
AAA
ABCDEFG
Sample Output
4
128

hey @bishtmanish786, in line no. 10, use s+=out[k] instead of s[k] = out[k]

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.