let exch = function
|'a' -> 'C'
|'b' -> 'A'
|'c' -> 'D'
|'d' -> 'B'
| c -> c (*All other characters are not changed*)
let rec crypt str num = (* Optional arguments in last position will cause problems *)
if num
<= String.length str
then begin
str.[num] <- exch (str.[num]);
crypt str (num+1)
end
let crypt str = crypt str 0
bGV0IGV4Y2ggPSBmdW5jdGlvbgogICAgfCdhJyAtPiAnQycKCXwnYicgLT4gJ0EnCgl8J2MnIC0+ICdEJwoJfCdkJyAtPiAnQicKICAgIHwgYyAgLT4gYyAoKkFsbCBvdGhlciBjaGFyYWN0ZXJzIGFyZSBub3QgY2hhbmdlZCopCgpsZXQgcmVjIGNyeXB0IHN0ciBudW0gPSAoKiBPcHRpb25hbCBhcmd1bWVudHMgaW4gbGFzdCBwb3NpdGlvbiB3aWxsIGNhdXNlIHByb2JsZW1zICopCiAgICBpZiBudW0gPD0gU3RyaW5nLmxlbmd0aCBzdHIgdGhlbgogICAgYmVnaW4KCQlzdHIuW251bV0gPC0gZXhjaCAoc3RyLltudW1dKTsKICAgICAgICBjcnlwdCBzdHIgKG51bSsxKQogICAgZW5kCgpsZXQgY3J5cHQgc3RyID0gY3J5cHQgc3RyIDA=