Skip to main content
4 of 9
deleted 1 character in body
jacksonecac
  • 2.6k
  • 15
  • 29

Generate a cipher

Generate a cipher given a number and string

Input:

integer n in the range of 0 <= n <= 9
string s phrase to encrypt in the cipher

Your task is simple. Given a string s and number n as inputs, insert a random printable ascii character between each character of the string n times. Such that for each character of s there are n random characters between them. Spaces should be trimmed.

Example:

Input:

The treasure is here
2

Output:

T!0h32eF4t0irlkehma7ys#0u*&r*he!2iH^sB,h!@e0)r$he

This is so the shortest code wins! Good Luck and have fun!

jacksonecac
  • 2.6k
  • 15
  • 29