by@drafear
WA
851ms
b,c;main(d){for(;~c;c=getchar())putchar(!d|b?99:c),b=c&1|b*d,d=84>c?++d%51:1;}
T K