# Converting to Secret Language [closed]

Write some code in any language that inputs a string such as "Today is a great day" (Note that there is no punctuation) and converts it to the "Secret Language". Here are the rules for the "Secret Language".

• a=c, b=d, c=e and so on (y=a and z=b)
• separate each word by a space
• make sure there is proper capitalization

Example:

Input: "Today is a great day"

Output: "Vqfca ku c itgcv fca"


It is a popularity-contest. Other users should give points by looking for most "to the point" yet "unique" code.

CHALLENGE: I was looking up uncommon programming languages and I found a language called Piet (esolang). I challenge anyone to write it in this language.

• Shouldn't that be x=z, y=a, z=b? Commented Feb 16, 2014 at 0:46
• you are right "duh" :) Commented Feb 16, 2014 at 0:47
• I was confused until I realized a=c is a -> c. Commented Feb 16, 2014 at 4:10
• In other words, ROT2 it Commented Feb 16, 2014 at 8:39
• Both rot13 and rot2 are both Caesar ciphers with different keys (13 and 2). Commented Feb 16, 2014 at 15:42

# C#, 163

Yes, this is not code-golf. I went for shortest anyway (or at least, made a first stab at it)

using System.Linq;class P{static void Main(string[]a){System.Console.WriteLine(string.Concat(a[0].Select(c=>(char)(c==32?c:c<89?c+2:c<91?c-24:c<121?c+2:c-24))));}}


Formatted:

using System.Linq;
class P
{
static void Main(string[] a)
{
System.Console.WriteLine(string.Concat(a[0].Select(c => (char)(c == 32 ? c : c < 89 ? c + 2 : c < 91 ? c - 24 : c < 121 ? c + 2 : c - 24))));
}
}


Yes, I did have a peek at ufis' answer.

C# 5KB

(381 chars)

391

using System;
namespace WinHelper {
class P {
static void Main(string[] args) {
char[] f =  "abcdefghijklmnopqrstuvwxyz ".ToCharArray();
char[] g =  "cdefghijklmnopqrstuvwxyzab ".ToCharArray();

Console.Write(g[Array.FindIndex(f, a => a == c)]);
}
}
}

• Compiled size (5KB) doesn't matter. For code-golf the number of chars (of sourcecode) usually counts, but since this particular challenge is a popularity contest and not code-golf the chars/size doesn't matter at all. Hover your mouse over the popularity contest badge beneath the challenge (you'll see a tooltip explaining it: "A popularity-contest is a competition where the correct answer with the most upvotes wins, usually the most creative answer"). Commented Feb 20, 2014 at 15:13
• Also, it crashes on the challenge's example input Today is a great day since it doesn't support uppercase letters. Commented Feb 21, 2014 at 1:24

# Bash, 8 characters

...if you happen to have the bsdgames package installed! Reads from standard input.

caesar 2


## Example

echo Today is a great day|caesar 2


Output: Vqfca ku c itgcv fca

## C

#include <stdio.h>
char c[100];
int main()
{
gets(c);
char *p=c,x;
while(*p)
{
x=*p;
if(x>='a'&&x<='z')
{
*p=((*p-'a'+2)%(26)+'a');
}
if(x>='A'&&x<='Z')
{
*p=((*p-'A'+2)%(26)+'A');
}

p++;
}
puts(c);
}


## Brainfuck

Must have (at least) 7-bit wrapping cells to work.

+[>,>+++++[<------>-]>[<<++++++++++++++++++++++++++++++.>>>+<]>-[<<<++++++++++++++++++++++++++++++++.[-]]<]

• Infinite input loop +[
• Get input >,
• Make a loop to get number 30 >+++++[<------>-]>
• If the symbol is a space, output the space [<<++++++++++++++++++++++++++++++.>>>+<]>-
• Otherwise, shift the ASCII value by two and output [<<<++++++++++++++++++++++++++++++++.[-]]<
• Get more input ]
• Timtech, you really like posting esoteric solutions without explaining what they do. When posting your answers, don't forget the explanation. Commented Feb 17, 2014 at 0:58
• -30 will always be true so it will just output the first character as is infinitely. Commented Feb 17, 2014 at 10:18
• @Quincunx Explanation added. Commented Feb 17, 2014 at 14:08
• @Timtech Very unusual cell size and I read at least as it would have to be a minimum. Where do you get a 7 bit interpreter? Commented Feb 18, 2014 at 17:19
• @Timtech 8 bit wrapping I can do and my interpreter is still printing Vqfc{"ku"c"itgcv"fc{ instead of Vqfca ku c itgcv fca. Commented Feb 19, 2014 at 1:24