Help me out in this problem


@KartikKhariwal are u there bro?

yup checking …

Hey @shivammishra20121999

   if(stoi(s.substr(index,2))<=26)         //2nd argument is length instead of ending index

@Kartikkhariwal1 what you are saying i didnot get it

2nd argument in substr function is length of the string u want to extract
and not the ending index

For example
s=“abcde”
here s.substr(2,1) == “c”
s.substr(2,2)==“cd”
s.substr(2,3) ==“cde”

@Kartikkhariwal1 ya this i know? but how this is affecting my error can u coorect it?

@Kartikkhariwal1 are u doing?

u used index +2 as second argument
I already corrected it

if(stoi(s.substr(index,2))<=26)

@Kartikkhariwal1 oh shit thanks u

1 Like