Hitachi Vantara interview question

Write a function to encrypt a string based on the shift integer.