I manage to run in time (over 40 sec), but now I'm getting WA.

If you have tried this problem, and made some io test cases,

please share it here. (Even If you are not sure that it is valid).

Heres some test cases I made (I'm not sure its valid).

**INPUT**

Code: Select all

```
1
abcdefghijk
2
abcabbeabbb
abcbeb
4
abcdedb
bcaeb
bfaea
dfafaeab
3
abcdefgh
gdibafjdc
cdkfc
2
abcdefgh
gdibafjdc
1
afghaj
2
abcdefghijk
adegjkh
3
abaec
cbced
dbdef
2
abaec
cbced
3
aikabegda
eghmbikj
dikabega
10
aaeaa
bbebb
ccecc
ddedd
ffeff
ggegg
hhehh
iieii
jjejj
kkekk
0
```

**OUTPUT**

Code: Select all

```
Case 1: Oops
Case 2: a1 b0 c* e=
Case 3: a1 b0 c* d8 e= f+
Case 4: f=
Case 5: f=
Case 6: a1 f+ g9 h= j0
Case 7: No
Case 8: a1 b+ c2 d4 e= f8
Case 9: Oops
Case 10: No
Case 11: No
```