This function is reversing the string "HTGATE".
Here, function substring() gives the substring from the $2^{\text{nd}}$ character of the original string till the end and contact(p,q) is concatenating the strings $p$ and $q.$
$n = s.$length means, $n = $ length of the string and $c[1]$ means, $1^{\text{st}}$ character of the passed string
So, it will work like this:
- what(HTGATE)
- contact(what(TGATE),H)
- contact(contact(what(GATE),T),H)
- contact(contact(contact(what(ATE),G),T),H)
- contact(contact(contact(contact(what(TE),A),G),T),H)
- contact(contact(contact(contact(contact(what(E),T),A),G),T),H)
- contact(contact(contact(contact(contact(E,T),A),G),T),H)
- contact(contact(contact(contact(ET,A),G),T),H)
- contact(contact(contact(ETA,G),T),H)
- contact(contact(ETAG,T),H)
- contact(ETAGT,H)
ETAGTH