fork download
  1. let exch = function
  2. |'a' -> 'C'
  3. |'b' -> 'A'
  4. |'c' -> 'D'
  5. |'d' -> 'B'
  6. | c -> c (*All other characters are not changed*)
  7.  
  8. let rec crypt str num = (* Optional arguments in last position will cause problems *)
  9. if num <= String.length str then
  10. begin
  11. str.[num] <- exch (str.[num]);
  12. crypt str (num+1)
  13. end
  14.  
  15. let crypt str = crypt str 0
Success #stdin #stdout 0.02s 2736KB
stdin
Standard input is empty
stdout
Standard output is empty