Expected ouput shows correct but while while submitting it shows different

programming
Tags: #<Tag:0x00007f24216f5c10>

#1

Here _ is asterisk

aab
c_a_b
Expected output : 0
Submit output : 1

acba
?b_a_ba
Expected output : 0
Submit output : 1

Could any help me out why this happening?