Doubt while solving question

https://ide.codingblocks.com/s/232786 despite this long code still shows error. Plz correct it

You are giving gap between key and 1 in lexico function . key1 is a variable.