Why i am not able to access mp1[s1[i]].second;

map is not pair type , there fore there is no “second” attribute,

in mp[s[0]] s[0] behaves as a characterr that was mapped and mp[s[0]] behaves as the integer to which it was mapped
so write
mp[s[0]]

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.