The Improved Caesar Pig Latin Cipher
Clash Royale CLAN TAG#URR8PPP
up vote
15
down vote
favorite
The problem with the Caesar cipher is the resulting words are often unpronounceable. The problem with Pig Latin is that it is easy to decode. Why not combine them?
Input
A word consisting of the 26 english letters.
Output
First, change every consonant in the word to the next consonant in the alphabet. So, b goes to c, d goes to f, and z goes to b. Then, change every vowel to the next vowel in the alphabet (u goes to a). Last, only if the first letter of the word is a consonant, move that letter to the end of the word and add "ay" to the end of the word.
Examples:
cat -> evday
dog -> uhfay
eel -> iim
- This is code-golf, so the shortest code wins.
- Case does not matter.
- Vowels that will be used are A, E, I, O, and U
code-golf string cipher
New contributor
qazwsx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
15
down vote
favorite
The problem with the Caesar cipher is the resulting words are often unpronounceable. The problem with Pig Latin is that it is easy to decode. Why not combine them?
Input
A word consisting of the 26 english letters.
Output
First, change every consonant in the word to the next consonant in the alphabet. So, b goes to c, d goes to f, and z goes to b. Then, change every vowel to the next vowel in the alphabet (u goes to a). Last, only if the first letter of the word is a consonant, move that letter to the end of the word and add "ay" to the end of the word.
Examples:
cat -> evday
dog -> uhfay
eel -> iim
- This is code-golf, so the shortest code wins.
- Case does not matter.
- Vowels that will be used are A, E, I, O, and U
code-golf string cipher
New contributor
qazwsx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
will we have capital letters in the input?
– Jo King
16 hours ago
2
no, but you can if you want
– qazwsx
16 hours ago
5
Welcome to PPCG! Very nice challenge, clearly presented.
– Jonathan Allan
15 hours ago
1
Suggested test case:z → bay
– Arnauld
15 hours ago
jot ot e wisz opvisitvoph dupdiqv cav o fu puv vjopl ov jimqt xovj vji ecomovz vu qsupuapdi vji xusftvay
– Shadow
8 hours ago
add a comment |Â
up vote
15
down vote
favorite
up vote
15
down vote
favorite
The problem with the Caesar cipher is the resulting words are often unpronounceable. The problem with Pig Latin is that it is easy to decode. Why not combine them?
Input
A word consisting of the 26 english letters.
Output
First, change every consonant in the word to the next consonant in the alphabet. So, b goes to c, d goes to f, and z goes to b. Then, change every vowel to the next vowel in the alphabet (u goes to a). Last, only if the first letter of the word is a consonant, move that letter to the end of the word and add "ay" to the end of the word.
Examples:
cat -> evday
dog -> uhfay
eel -> iim
- This is code-golf, so the shortest code wins.
- Case does not matter.
- Vowels that will be used are A, E, I, O, and U
code-golf string cipher
New contributor
qazwsx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
The problem with the Caesar cipher is the resulting words are often unpronounceable. The problem with Pig Latin is that it is easy to decode. Why not combine them?
Input
A word consisting of the 26 english letters.
Output
First, change every consonant in the word to the next consonant in the alphabet. So, b goes to c, d goes to f, and z goes to b. Then, change every vowel to the next vowel in the alphabet (u goes to a). Last, only if the first letter of the word is a consonant, move that letter to the end of the word and add "ay" to the end of the word.
Examples:
cat -> evday
dog -> uhfay
eel -> iim
- This is code-golf, so the shortest code wins.
- Case does not matter.
- Vowels that will be used are A, E, I, O, and U
code-golf string cipher
code-golf string cipher
New contributor
qazwsx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
qazwsx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 27 mins ago


u_ndefined
2918
2918
New contributor
qazwsx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 17 hours ago
qazwsx
764
764
New contributor
qazwsx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
qazwsx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
qazwsx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
will we have capital letters in the input?
– Jo King
16 hours ago
2
no, but you can if you want
– qazwsx
16 hours ago
5
Welcome to PPCG! Very nice challenge, clearly presented.
– Jonathan Allan
15 hours ago
1
Suggested test case:z → bay
– Arnauld
15 hours ago
jot ot e wisz opvisitvoph dupdiqv cav o fu puv vjopl ov jimqt xovj vji ecomovz vu qsupuapdi vji xusftvay
– Shadow
8 hours ago
add a comment |Â
will we have capital letters in the input?
– Jo King
16 hours ago
2
no, but you can if you want
– qazwsx
16 hours ago
5
Welcome to PPCG! Very nice challenge, clearly presented.
– Jonathan Allan
15 hours ago
1
Suggested test case:z → bay
– Arnauld
15 hours ago
jot ot e wisz opvisitvoph dupdiqv cav o fu puv vjopl ov jimqt xovj vji ecomovz vu qsupuapdi vji xusftvay
– Shadow
8 hours ago
will we have capital letters in the input?
– Jo King
16 hours ago
will we have capital letters in the input?
– Jo King
16 hours ago
2
2
no, but you can if you want
– qazwsx
16 hours ago
no, but you can if you want
– qazwsx
16 hours ago
5
5
Welcome to PPCG! Very nice challenge, clearly presented.
– Jonathan Allan
15 hours ago
Welcome to PPCG! Very nice challenge, clearly presented.
– Jonathan Allan
15 hours ago
1
1
Suggested test case:
z → bay
– Arnauld
15 hours ago
Suggested test case:
z → bay
– Arnauld
15 hours ago
jot ot e wisz opvisitvoph dupdiqv cav o fu puv vjopl ov jimqt xovj vji ecomovz vu qsupuapdi vji xusftvay
– Shadow
8 hours ago
jot ot e wisz opvisitvoph dupdiqv cav o fu puv vjopl ov jimqt xovj vji ecomovz vu qsupuapdi vji xusftvay
– Shadow
8 hours ago
add a comment |Â
10 Answers
10
active
oldest
votes
up vote
3
down vote
05AB1E, 21 bytes
žMDÀ‡žNDÀ‡¬žNsåiÀ…ÿay
Try it online!
Explanation
žMDÀ‡ # replace each vowel with the next vowel in the alphabet
žNDÀ‡ # replace each consonant with the next consonant in the alphabet
¬žNsåi # if the first letter is a consonant
À…ÿay # rotate the word left and add "ay"
1
Dof zua iwis jies vji vsehifz ug Desvj Pmehaiot Tji Woti? I vjuahjv puv. Iv't puv e tvusz vji Jifo xuamf vimm zua. Iv't e Sovj mihipf.
– qazwsx
16 hours ago
@qazwsx "Did you ever hear the tragedy of Darth Plagueis The Wise? I thought not. It's not a story the Jedi would tell you. It's a Sith legend."
– Kevin Cruijssen
6 hours ago
add a comment |Â
up vote
3
down vote
R, 86 bytes
Simple way. chartr
has the charming and useful property that it can specify letter ranges, which save a few bytes.
function(s)sub("^([^aeiou])(.*)","\2\1ay",chartr("a-z","ecdfighjok-npuq-tvaw-zb",s))
Try it online!
add a comment |Â
up vote
2
down vote
JavaScript (Node.js), 121 116 bytes
Expects the input string in lower case.
s=>(v=n=>2130466>>n&1)((a=Buffer(s).map(n=>(g=i=>v(n=n%61?n+1:97)^i?g(i):n)(v(n))))[0],a+='')?a:a.slice(1)+a[0]+'ay'
Try it online!
add a comment |Â
up vote
2
down vote
Retina 0.8.2, 50 bytes
T`uo`aeioub-df-hj-np-tv-zb
^([^aeiou])(.*)
$2$1ay
Try it online! Link includes test cases. Similar approach to the R answer. Explanation:
T`uo`aeioub-df-hj-np-tv-zb
o
refers to the other set, i.e. aeioub-df-hj-np-tv-zb
, which expands to aeioubcdfghjlkmnpqrstvwxyzb
, so uo
expands to uaeioubcdfghjlkmnpqrstvwxyzb
. This results in the following transliteration:
uaeioubcdfghjlkmnpqrstvwxyzb
aeioubcdfghjlkmnpqrstvwxyzb
The second u
and b
are ignored as they can never be matched, so this provides the desired cipher. (Note that in Retina 1 you can of course use v
instead of aeiou
for a 5 byte saving.)
^([^aeiou])(.*)
$2$1ay
If the first letter is not a vowel, rotate it to the end and suffix ay
.
add a comment |Â
up vote
2
down vote
Python 2, 153 121 110 99 bytes
lambda s:''.join('ecdfighjoklmnpuqrstvawxyzb'[ord(c)-97]for c in[s[1:]+s[0]+'ux',s][s[0]in'aeiou'])
Try it online!
add a comment |Â
up vote
1
down vote
Jelly, 24 bytes
,ṙ¥1y
ØẹçØḄçṙḢe©ØḄƊ®â¾ayx
Try it online!
Saved 1 byte thanks to Jonathan Allan (use the two-char syntax rather than quotes).
Unfortunately far longer sane, non-sneaky version (1-byte shorter sneaky equivalent). I won't be able to update this within the next few hours, but do point out if you find improvements.
– Mr. Xcoder
15 hours ago
Useâ¾ay
for a byte. The©
could go after thee
since that is what you are storing. I haveØáº¹Øá¸„,żṙ€¥1ẎyṙḢe©Øá¸„ÆŠ®â¾ayẋ
.
– Jonathan Allan
11 hours ago
add a comment |Â
up vote
1
down vote
Java (JDK 10), 175 bytes
s->String r="",a="aeiouabcdfghjklmnpqrstvwxyzb";char c=s.charAt(0);if(a.indexOf(c)>5)s=s.substring(1)+c+"ux";for(char d:s.toCharArray())r+=a.charAt(a.indexOf(d)+1);return r;
Try it online!
add a comment |Â
up vote
1
down vote
><>, 94 bytes
i:0(?v84*%
2%?!v~r:5g
37r}<vr*46*
ol?!;>4g
ecdfighjoklmnpuqrstvawxyzb
1 1 1 1 1
Try it online!
add a comment |Â
up vote
1
down vote
Ruby, 96 69 bytes
->s/^[^aeiou]/=~(r=s.tr'zb-yadehinotu','b-zefijopuva')?$'+$&+'ay':r
Try it online!
Fun fact of the day: tr() matches strings right-to-left. I always assumed it was left-to-right.
add a comment |Â
up vote
0
down vote
Red, 149 bytes
func[s][c:"aeioua.bcdfghjklmnpqrstvwxyzb"t: copy""foreach p s[append t c/(1
+ index? find c p)]if 7 < index? find c t/1[move t tail t append t"ay"]t]
Try it online!
As (almost) always, the longest entry
add a comment |Â
10 Answers
10
active
oldest
votes
10 Answers
10
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
05AB1E, 21 bytes
žMDÀ‡žNDÀ‡¬žNsåiÀ…ÿay
Try it online!
Explanation
žMDÀ‡ # replace each vowel with the next vowel in the alphabet
žNDÀ‡ # replace each consonant with the next consonant in the alphabet
¬žNsåi # if the first letter is a consonant
À…ÿay # rotate the word left and add "ay"
1
Dof zua iwis jies vji vsehifz ug Desvj Pmehaiot Tji Woti? I vjuahjv puv. Iv't puv e tvusz vji Jifo xuamf vimm zua. Iv't e Sovj mihipf.
– qazwsx
16 hours ago
@qazwsx "Did you ever hear the tragedy of Darth Plagueis The Wise? I thought not. It's not a story the Jedi would tell you. It's a Sith legend."
– Kevin Cruijssen
6 hours ago
add a comment |Â
up vote
3
down vote
05AB1E, 21 bytes
žMDÀ‡žNDÀ‡¬žNsåiÀ…ÿay
Try it online!
Explanation
žMDÀ‡ # replace each vowel with the next vowel in the alphabet
žNDÀ‡ # replace each consonant with the next consonant in the alphabet
¬žNsåi # if the first letter is a consonant
À…ÿay # rotate the word left and add "ay"
1
Dof zua iwis jies vji vsehifz ug Desvj Pmehaiot Tji Woti? I vjuahjv puv. Iv't puv e tvusz vji Jifo xuamf vimm zua. Iv't e Sovj mihipf.
– qazwsx
16 hours ago
@qazwsx "Did you ever hear the tragedy of Darth Plagueis The Wise? I thought not. It's not a story the Jedi would tell you. It's a Sith legend."
– Kevin Cruijssen
6 hours ago
add a comment |Â
up vote
3
down vote
up vote
3
down vote
05AB1E, 21 bytes
žMDÀ‡žNDÀ‡¬žNsåiÀ…ÿay
Try it online!
Explanation
žMDÀ‡ # replace each vowel with the next vowel in the alphabet
žNDÀ‡ # replace each consonant with the next consonant in the alphabet
¬žNsåi # if the first letter is a consonant
À…ÿay # rotate the word left and add "ay"
05AB1E, 21 bytes
žMDÀ‡žNDÀ‡¬žNsåiÀ…ÿay
Try it online!
Explanation
žMDÀ‡ # replace each vowel with the next vowel in the alphabet
žNDÀ‡ # replace each consonant with the next consonant in the alphabet
¬žNsåi # if the first letter is a consonant
À…ÿay # rotate the word left and add "ay"
answered 16 hours ago


Emigna
43.1k431131
43.1k431131
1
Dof zua iwis jies vji vsehifz ug Desvj Pmehaiot Tji Woti? I vjuahjv puv. Iv't puv e tvusz vji Jifo xuamf vimm zua. Iv't e Sovj mihipf.
– qazwsx
16 hours ago
@qazwsx "Did you ever hear the tragedy of Darth Plagueis The Wise? I thought not. It's not a story the Jedi would tell you. It's a Sith legend."
– Kevin Cruijssen
6 hours ago
add a comment |Â
1
Dof zua iwis jies vji vsehifz ug Desvj Pmehaiot Tji Woti? I vjuahjv puv. Iv't puv e tvusz vji Jifo xuamf vimm zua. Iv't e Sovj mihipf.
– qazwsx
16 hours ago
@qazwsx "Did you ever hear the tragedy of Darth Plagueis The Wise? I thought not. It's not a story the Jedi would tell you. It's a Sith legend."
– Kevin Cruijssen
6 hours ago
1
1
Dof zua iwis jies vji vsehifz ug Desvj Pmehaiot Tji Woti? I vjuahjv puv. Iv't puv e tvusz vji Jifo xuamf vimm zua. Iv't e Sovj mihipf.
– qazwsx
16 hours ago
Dof zua iwis jies vji vsehifz ug Desvj Pmehaiot Tji Woti? I vjuahjv puv. Iv't puv e tvusz vji Jifo xuamf vimm zua. Iv't e Sovj mihipf.
– qazwsx
16 hours ago
@qazwsx "Did you ever hear the tragedy of Darth Plagueis The Wise? I thought not. It's not a story the Jedi would tell you. It's a Sith legend."
– Kevin Cruijssen
6 hours ago
@qazwsx "Did you ever hear the tragedy of Darth Plagueis The Wise? I thought not. It's not a story the Jedi would tell you. It's a Sith legend."
– Kevin Cruijssen
6 hours ago
add a comment |Â
up vote
3
down vote
R, 86 bytes
Simple way. chartr
has the charming and useful property that it can specify letter ranges, which save a few bytes.
function(s)sub("^([^aeiou])(.*)","\2\1ay",chartr("a-z","ecdfighjok-npuq-tvaw-zb",s))
Try it online!
add a comment |Â
up vote
3
down vote
R, 86 bytes
Simple way. chartr
has the charming and useful property that it can specify letter ranges, which save a few bytes.
function(s)sub("^([^aeiou])(.*)","\2\1ay",chartr("a-z","ecdfighjok-npuq-tvaw-zb",s))
Try it online!
add a comment |Â
up vote
3
down vote
up vote
3
down vote
R, 86 bytes
Simple way. chartr
has the charming and useful property that it can specify letter ranges, which save a few bytes.
function(s)sub("^([^aeiou])(.*)","\2\1ay",chartr("a-z","ecdfighjok-npuq-tvaw-zb",s))
Try it online!
R, 86 bytes
Simple way. chartr
has the charming and useful property that it can specify letter ranges, which save a few bytes.
function(s)sub("^([^aeiou])(.*)","\2\1ay",chartr("a-z","ecdfighjok-npuq-tvaw-zb",s))
Try it online!
edited 14 hours ago
answered 16 hours ago
J.Doe
7419
7419
add a comment |Â
add a comment |Â
up vote
2
down vote
JavaScript (Node.js), 121 116 bytes
Expects the input string in lower case.
s=>(v=n=>2130466>>n&1)((a=Buffer(s).map(n=>(g=i=>v(n=n%61?n+1:97)^i?g(i):n)(v(n))))[0],a+='')?a:a.slice(1)+a[0]+'ay'
Try it online!
add a comment |Â
up vote
2
down vote
JavaScript (Node.js), 121 116 bytes
Expects the input string in lower case.
s=>(v=n=>2130466>>n&1)((a=Buffer(s).map(n=>(g=i=>v(n=n%61?n+1:97)^i?g(i):n)(v(n))))[0],a+='')?a:a.slice(1)+a[0]+'ay'
Try it online!
add a comment |Â
up vote
2
down vote
up vote
2
down vote
JavaScript (Node.js), 121 116 bytes
Expects the input string in lower case.
s=>(v=n=>2130466>>n&1)((a=Buffer(s).map(n=>(g=i=>v(n=n%61?n+1:97)^i?g(i):n)(v(n))))[0],a+='')?a:a.slice(1)+a[0]+'ay'
Try it online!
JavaScript (Node.js), 121 116 bytes
Expects the input string in lower case.
s=>(v=n=>2130466>>n&1)((a=Buffer(s).map(n=>(g=i=>v(n=n%61?n+1:97)^i?g(i):n)(v(n))))[0],a+='')?a:a.slice(1)+a[0]+'ay'
Try it online!
edited 14 hours ago
answered 15 hours ago


Arnauld
64.2k580270
64.2k580270
add a comment |Â
add a comment |Â
up vote
2
down vote
Retina 0.8.2, 50 bytes
T`uo`aeioub-df-hj-np-tv-zb
^([^aeiou])(.*)
$2$1ay
Try it online! Link includes test cases. Similar approach to the R answer. Explanation:
T`uo`aeioub-df-hj-np-tv-zb
o
refers to the other set, i.e. aeioub-df-hj-np-tv-zb
, which expands to aeioubcdfghjlkmnpqrstvwxyzb
, so uo
expands to uaeioubcdfghjlkmnpqrstvwxyzb
. This results in the following transliteration:
uaeioubcdfghjlkmnpqrstvwxyzb
aeioubcdfghjlkmnpqrstvwxyzb
The second u
and b
are ignored as they can never be matched, so this provides the desired cipher. (Note that in Retina 1 you can of course use v
instead of aeiou
for a 5 byte saving.)
^([^aeiou])(.*)
$2$1ay
If the first letter is not a vowel, rotate it to the end and suffix ay
.
add a comment |Â
up vote
2
down vote
Retina 0.8.2, 50 bytes
T`uo`aeioub-df-hj-np-tv-zb
^([^aeiou])(.*)
$2$1ay
Try it online! Link includes test cases. Similar approach to the R answer. Explanation:
T`uo`aeioub-df-hj-np-tv-zb
o
refers to the other set, i.e. aeioub-df-hj-np-tv-zb
, which expands to aeioubcdfghjlkmnpqrstvwxyzb
, so uo
expands to uaeioubcdfghjlkmnpqrstvwxyzb
. This results in the following transliteration:
uaeioubcdfghjlkmnpqrstvwxyzb
aeioubcdfghjlkmnpqrstvwxyzb
The second u
and b
are ignored as they can never be matched, so this provides the desired cipher. (Note that in Retina 1 you can of course use v
instead of aeiou
for a 5 byte saving.)
^([^aeiou])(.*)
$2$1ay
If the first letter is not a vowel, rotate it to the end and suffix ay
.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Retina 0.8.2, 50 bytes
T`uo`aeioub-df-hj-np-tv-zb
^([^aeiou])(.*)
$2$1ay
Try it online! Link includes test cases. Similar approach to the R answer. Explanation:
T`uo`aeioub-df-hj-np-tv-zb
o
refers to the other set, i.e. aeioub-df-hj-np-tv-zb
, which expands to aeioubcdfghjlkmnpqrstvwxyzb
, so uo
expands to uaeioubcdfghjlkmnpqrstvwxyzb
. This results in the following transliteration:
uaeioubcdfghjlkmnpqrstvwxyzb
aeioubcdfghjlkmnpqrstvwxyzb
The second u
and b
are ignored as they can never be matched, so this provides the desired cipher. (Note that in Retina 1 you can of course use v
instead of aeiou
for a 5 byte saving.)
^([^aeiou])(.*)
$2$1ay
If the first letter is not a vowel, rotate it to the end and suffix ay
.
Retina 0.8.2, 50 bytes
T`uo`aeioub-df-hj-np-tv-zb
^([^aeiou])(.*)
$2$1ay
Try it online! Link includes test cases. Similar approach to the R answer. Explanation:
T`uo`aeioub-df-hj-np-tv-zb
o
refers to the other set, i.e. aeioub-df-hj-np-tv-zb
, which expands to aeioubcdfghjlkmnpqrstvwxyzb
, so uo
expands to uaeioubcdfghjlkmnpqrstvwxyzb
. This results in the following transliteration:
uaeioubcdfghjlkmnpqrstvwxyzb
aeioubcdfghjlkmnpqrstvwxyzb
The second u
and b
are ignored as they can never be matched, so this provides the desired cipher. (Note that in Retina 1 you can of course use v
instead of aeiou
for a 5 byte saving.)
^([^aeiou])(.*)
$2$1ay
If the first letter is not a vowel, rotate it to the end and suffix ay
.
answered 12 hours ago
Neil
75.3k744170
75.3k744170
add a comment |Â
add a comment |Â
up vote
2
down vote
Python 2, 153 121 110 99 bytes
lambda s:''.join('ecdfighjoklmnpuqrstvawxyzb'[ord(c)-97]for c in[s[1:]+s[0]+'ux',s][s[0]in'aeiou'])
Try it online!
add a comment |Â
up vote
2
down vote
Python 2, 153 121 110 99 bytes
lambda s:''.join('ecdfighjoklmnpuqrstvawxyzb'[ord(c)-97]for c in[s[1:]+s[0]+'ux',s][s[0]in'aeiou'])
Try it online!
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Python 2, 153 121 110 99 bytes
lambda s:''.join('ecdfighjoklmnpuqrstvawxyzb'[ord(c)-97]for c in[s[1:]+s[0]+'ux',s][s[0]in'aeiou'])
Try it online!
Python 2, 153 121 110 99 bytes
lambda s:''.join('ecdfighjoklmnpuqrstvawxyzb'[ord(c)-97]for c in[s[1:]+s[0]+'ux',s][s[0]in'aeiou'])
Try it online!
edited 10 hours ago
answered 15 hours ago
Chas Brown
4,2261319
4,2261319
add a comment |Â
add a comment |Â
up vote
1
down vote
Jelly, 24 bytes
,ṙ¥1y
ØẹçØḄçṙḢe©ØḄƊ®â¾ayx
Try it online!
Saved 1 byte thanks to Jonathan Allan (use the two-char syntax rather than quotes).
Unfortunately far longer sane, non-sneaky version (1-byte shorter sneaky equivalent). I won't be able to update this within the next few hours, but do point out if you find improvements.
– Mr. Xcoder
15 hours ago
Useâ¾ay
for a byte. The©
could go after thee
since that is what you are storing. I haveØáº¹Øá¸„,żṙ€¥1ẎyṙḢe©Øá¸„ÆŠ®â¾ayẋ
.
– Jonathan Allan
11 hours ago
add a comment |Â
up vote
1
down vote
Jelly, 24 bytes
,ṙ¥1y
ØẹçØḄçṙḢe©ØḄƊ®â¾ayx
Try it online!
Saved 1 byte thanks to Jonathan Allan (use the two-char syntax rather than quotes).
Unfortunately far longer sane, non-sneaky version (1-byte shorter sneaky equivalent). I won't be able to update this within the next few hours, but do point out if you find improvements.
– Mr. Xcoder
15 hours ago
Useâ¾ay
for a byte. The©
could go after thee
since that is what you are storing. I haveØáº¹Øá¸„,żṙ€¥1ẎyṙḢe©Øá¸„ÆŠ®â¾ayẋ
.
– Jonathan Allan
11 hours ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Jelly, 24 bytes
,ṙ¥1y
ØẹçØḄçṙḢe©ØḄƊ®â¾ayx
Try it online!
Saved 1 byte thanks to Jonathan Allan (use the two-char syntax rather than quotes).
Jelly, 24 bytes
,ṙ¥1y
ØẹçØḄçṙḢe©ØḄƊ®â¾ayx
Try it online!
Saved 1 byte thanks to Jonathan Allan (use the two-char syntax rather than quotes).
edited 5 hours ago
answered 15 hours ago


Mr. Xcoder
30.4k758193
30.4k758193
Unfortunately far longer sane, non-sneaky version (1-byte shorter sneaky equivalent). I won't be able to update this within the next few hours, but do point out if you find improvements.
– Mr. Xcoder
15 hours ago
Useâ¾ay
for a byte. The©
could go after thee
since that is what you are storing. I haveØáº¹Øá¸„,żṙ€¥1ẎyṙḢe©Øá¸„ÆŠ®â¾ayẋ
.
– Jonathan Allan
11 hours ago
add a comment |Â
Unfortunately far longer sane, non-sneaky version (1-byte shorter sneaky equivalent). I won't be able to update this within the next few hours, but do point out if you find improvements.
– Mr. Xcoder
15 hours ago
Useâ¾ay
for a byte. The©
could go after thee
since that is what you are storing. I haveØáº¹Øá¸„,żṙ€¥1ẎyṙḢe©Øá¸„ÆŠ®â¾ayẋ
.
– Jonathan Allan
11 hours ago
Unfortunately far longer sane, non-sneaky version (1-byte shorter sneaky equivalent). I won't be able to update this within the next few hours, but do point out if you find improvements.
– Mr. Xcoder
15 hours ago
Unfortunately far longer sane, non-sneaky version (1-byte shorter sneaky equivalent). I won't be able to update this within the next few hours, but do point out if you find improvements.
– Mr. Xcoder
15 hours ago
Use
â¾ay
for a byte. The ©
could go after the e
since that is what you are storing. I have Øáº¹Øá¸„,żṙ€¥1ẎyṙḢe©Øá¸„ÆŠ®â¾ayẋ
.– Jonathan Allan
11 hours ago
Use
â¾ay
for a byte. The ©
could go after the e
since that is what you are storing. I have Øáº¹Øá¸„,żṙ€¥1ẎyṙḢe©Øá¸„ÆŠ®â¾ayẋ
.– Jonathan Allan
11 hours ago
add a comment |Â
up vote
1
down vote
Java (JDK 10), 175 bytes
s->String r="",a="aeiouabcdfghjklmnpqrstvwxyzb";char c=s.charAt(0);if(a.indexOf(c)>5)s=s.substring(1)+c+"ux";for(char d:s.toCharArray())r+=a.charAt(a.indexOf(d)+1);return r;
Try it online!
add a comment |Â
up vote
1
down vote
Java (JDK 10), 175 bytes
s->String r="",a="aeiouabcdfghjklmnpqrstvwxyzb";char c=s.charAt(0);if(a.indexOf(c)>5)s=s.substring(1)+c+"ux";for(char d:s.toCharArray())r+=a.charAt(a.indexOf(d)+1);return r;
Try it online!
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Java (JDK 10), 175 bytes
s->String r="",a="aeiouabcdfghjklmnpqrstvwxyzb";char c=s.charAt(0);if(a.indexOf(c)>5)s=s.substring(1)+c+"ux";for(char d:s.toCharArray())r+=a.charAt(a.indexOf(d)+1);return r;
Try it online!
Java (JDK 10), 175 bytes
s->String r="",a="aeiouabcdfghjklmnpqrstvwxyzb";char c=s.charAt(0);if(a.indexOf(c)>5)s=s.substring(1)+c+"ux";for(char d:s.toCharArray())r+=a.charAt(a.indexOf(d)+1);return r;
Try it online!
answered 4 hours ago


Olivier Grégoire
7,63111741
7,63111741
add a comment |Â
add a comment |Â
up vote
1
down vote
><>, 94 bytes
i:0(?v84*%
2%?!v~r:5g
37r}<vr*46*
ol?!;>4g
ecdfighjoklmnpuqrstvawxyzb
1 1 1 1 1
Try it online!
add a comment |Â
up vote
1
down vote
><>, 94 bytes
i:0(?v84*%
2%?!v~r:5g
37r}<vr*46*
ol?!;>4g
ecdfighjoklmnpuqrstvawxyzb
1 1 1 1 1
Try it online!
add a comment |Â
up vote
1
down vote
up vote
1
down vote
><>, 94 bytes
i:0(?v84*%
2%?!v~r:5g
37r}<vr*46*
ol?!;>4g
ecdfighjoklmnpuqrstvawxyzb
1 1 1 1 1
Try it online!
><>, 94 bytes
i:0(?v84*%
2%?!v~r:5g
37r}<vr*46*
ol?!;>4g
ecdfighjoklmnpuqrstvawxyzb
1 1 1 1 1
Try it online!
edited 3 hours ago
answered 3 hours ago


Sok
2,871722
2,871722
add a comment |Â
add a comment |Â
up vote
1
down vote
Ruby, 96 69 bytes
->s/^[^aeiou]/=~(r=s.tr'zb-yadehinotu','b-zefijopuva')?$'+$&+'ay':r
Try it online!
Fun fact of the day: tr() matches strings right-to-left. I always assumed it was left-to-right.
add a comment |Â
up vote
1
down vote
Ruby, 96 69 bytes
->s/^[^aeiou]/=~(r=s.tr'zb-yadehinotu','b-zefijopuva')?$'+$&+'ay':r
Try it online!
Fun fact of the day: tr() matches strings right-to-left. I always assumed it was left-to-right.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Ruby, 96 69 bytes
->s/^[^aeiou]/=~(r=s.tr'zb-yadehinotu','b-zefijopuva')?$'+$&+'ay':r
Try it online!
Fun fact of the day: tr() matches strings right-to-left. I always assumed it was left-to-right.
Ruby, 96 69 bytes
->s/^[^aeiou]/=~(r=s.tr'zb-yadehinotu','b-zefijopuva')?$'+$&+'ay':r
Try it online!
Fun fact of the day: tr() matches strings right-to-left. I always assumed it was left-to-right.
edited 1 hour ago
answered 1 hour ago
G B
6,4071324
6,4071324
add a comment |Â
add a comment |Â
up vote
0
down vote
Red, 149 bytes
func[s][c:"aeioua.bcdfghjklmnpqrstvwxyzb"t: copy""foreach p s[append t c/(1
+ index? find c p)]if 7 < index? find c t/1[move t tail t append t"ay"]t]
Try it online!
As (almost) always, the longest entry
add a comment |Â
up vote
0
down vote
Red, 149 bytes
func[s][c:"aeioua.bcdfghjklmnpqrstvwxyzb"t: copy""foreach p s[append t c/(1
+ index? find c p)]if 7 < index? find c t/1[move t tail t append t"ay"]t]
Try it online!
As (almost) always, the longest entry
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Red, 149 bytes
func[s][c:"aeioua.bcdfghjklmnpqrstvwxyzb"t: copy""foreach p s[append t c/(1
+ index? find c p)]if 7 < index? find c t/1[move t tail t append t"ay"]t]
Try it online!
As (almost) always, the longest entry
Red, 149 bytes
func[s][c:"aeioua.bcdfghjklmnpqrstvwxyzb"t: copy""foreach p s[append t c/(1
+ index? find c p)]if 7 < index? find c t/1[move t tail t append t"ay"]t]
Try it online!
As (almost) always, the longest entry
answered 4 hours ago
Galen Ivanov
4,7871829
4,7871829
add a comment |Â
add a comment |Â
qazwsx is a new contributor. Be nice, and check out our Code of Conduct.
qazwsx is a new contributor. Be nice, and check out our Code of Conduct.
qazwsx is a new contributor. Be nice, and check out our Code of Conduct.
qazwsx is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f172281%2fthe-improved-caesar-pig-latin-cipher%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
will we have capital letters in the input?
– Jo King
16 hours ago
2
no, but you can if you want
– qazwsx
16 hours ago
5
Welcome to PPCG! Very nice challenge, clearly presented.
– Jonathan Allan
15 hours ago
1
Suggested test case:
z → bay
– Arnauld
15 hours ago
jot ot e wisz opvisitvoph dupdiqv cav o fu puv vjopl ov jimqt xovj vji ecomovz vu qsupuapdi vji xusftvay
– Shadow
8 hours ago