The Improved Caesar Pig Latin Cypher

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite












The problem with the caesar cypher 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 outputs evday

dog outputs uhfay

eel outputs iim



This is code golf, so the shortest code wins.
Case does not matter. Vowels are A, E, I, O, and U










share|improve this question









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
    36 mins ago






  • 1




    no, but you can if you want
    – qazwsx
    34 mins ago






  • 1




    Welcome to PPCG! Very nice challenge, clearly presented.
    – Jonathan Allan
    30 mins ago










  • Suggested test case: z → bay
    – Arnauld
    21 mins ago














up vote
4
down vote

favorite












The problem with the caesar cypher 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 outputs evday

dog outputs uhfay

eel outputs iim



This is code golf, so the shortest code wins.
Case does not matter. Vowels are A, E, I, O, and U










share|improve this question









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
    36 mins ago






  • 1




    no, but you can if you want
    – qazwsx
    34 mins ago






  • 1




    Welcome to PPCG! Very nice challenge, clearly presented.
    – Jonathan Allan
    30 mins ago










  • Suggested test case: z → bay
    – Arnauld
    21 mins ago












up vote
4
down vote

favorite









up vote
4
down vote

favorite











The problem with the caesar cypher 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 outputs evday

dog outputs uhfay

eel outputs iim



This is code golf, so the shortest code wins.
Case does not matter. Vowels are A, E, I, O, and U










share|improve this question









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 cypher 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 outputs evday

dog outputs uhfay

eel outputs iim



This is code golf, so the shortest code wins.
Case does not matter. Vowels are A, E, I, O, and U







code-golf






share|improve this question









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.











share|improve this question









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.









share|improve this question




share|improve this question








edited 1 hour ago





















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 2 hours ago









qazwsx

213




213




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
    36 mins ago






  • 1




    no, but you can if you want
    – qazwsx
    34 mins ago






  • 1




    Welcome to PPCG! Very nice challenge, clearly presented.
    – Jonathan Allan
    30 mins ago










  • Suggested test case: z → bay
    – Arnauld
    21 mins ago
















  • will we have capital letters in the input?
    – Jo King
    36 mins ago






  • 1




    no, but you can if you want
    – qazwsx
    34 mins ago






  • 1




    Welcome to PPCG! Very nice challenge, clearly presented.
    – Jonathan Allan
    30 mins ago










  • Suggested test case: z → bay
    – Arnauld
    21 mins ago















will we have capital letters in the input?
– Jo King
36 mins ago




will we have capital letters in the input?
– Jo King
36 mins ago




1




1




no, but you can if you want
– qazwsx
34 mins ago




no, but you can if you want
– qazwsx
34 mins ago




1




1




Welcome to PPCG! Very nice challenge, clearly presented.
– Jonathan Allan
30 mins ago




Welcome to PPCG! Very nice challenge, clearly presented.
– Jonathan Allan
30 mins ago












Suggested test case: z → bay
– Arnauld
21 mins ago




Suggested test case: z → bay
– Arnauld
21 mins ago










4 Answers
4






active

oldest

votes

















up vote
1
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"





share|improve this answer




















  • 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
    55 mins ago

















up vote
1
down vote














JavaScript (Node.js), 121 bytes



Expects the input string in lower case.





s=>(v=n=>2130466>>n&1)((a=Buffer(s).map(n=>(i=v(n),g=n=>n++%61?v(n)^i?g(n):n:g(96))(n)))[0],a+='')?a:a.slice(1)+a[0]+'ay'


Try it online!






share|improve this answer



























    up vote
    1
    down vote














    R, 101 bytes



    The simple way. Now slightly less obvious.





    function(s)sub("^([^aeiou])(.*)","\2\1ay",chartr(intToUtf8(97:122),"ecdfighjoklmnpuqrstvawxyzb",s))


    Try it online!






    share|improve this answer





























      up vote
      1
      down vote














      Jelly, 25 bytes



      ,ṙ¥1y
      ØẹçØḄçṙḢeØḄƊ©®“ay”x


      Try it online!



      What am I doing? Honestly I'm questioning my sanity (really, ©®?!), this is a sneaky and probably trivial-to-outgolf solution! Only works as a full program because it's too strange... Will try to bring it to normal soon.





      share




















        Your Answer




        StackExchange.ifUsing("editor", function ()
        return StackExchange.using("mathjaxEditing", function ()
        StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
        StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
        );
        );
        , "mathjax-editing");

        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "200"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        convertImagesToLinks: false,
        noModals: false,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );






        qazwsx is a new contributor. Be nice, and check out our Code of Conduct.









         

        draft saved


        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f172281%2fthe-improved-caesar-pig-latin-cypher%23new-answer', 'question_page');

        );

        Post as a guest






























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        1
        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"





        share|improve this answer




















        • 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
          55 mins ago














        up vote
        1
        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"





        share|improve this answer




















        • 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
          55 mins ago












        up vote
        1
        down vote










        up vote
        1
        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"





        share|improve this answer













        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"






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 1 hour ago









        Emigna

        43k431131




        43k431131











        • 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
          55 mins 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
          55 mins 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
        55 mins 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
        55 mins ago










        up vote
        1
        down vote














        JavaScript (Node.js), 121 bytes



        Expects the input string in lower case.





        s=>(v=n=>2130466>>n&1)((a=Buffer(s).map(n=>(i=v(n),g=n=>n++%61?v(n)^i?g(n):n:g(96))(n)))[0],a+='')?a:a.slice(1)+a[0]+'ay'


        Try it online!






        share|improve this answer
























          up vote
          1
          down vote














          JavaScript (Node.js), 121 bytes



          Expects the input string in lower case.





          s=>(v=n=>2130466>>n&1)((a=Buffer(s).map(n=>(i=v(n),g=n=>n++%61?v(n)^i?g(n):n:g(96))(n)))[0],a+='')?a:a.slice(1)+a[0]+'ay'


          Try it online!






          share|improve this answer






















            up vote
            1
            down vote










            up vote
            1
            down vote










            JavaScript (Node.js), 121 bytes



            Expects the input string in lower case.





            s=>(v=n=>2130466>>n&1)((a=Buffer(s).map(n=>(i=v(n),g=n=>n++%61?v(n)^i?g(n):n:g(96))(n)))[0],a+='')?a:a.slice(1)+a[0]+'ay'


            Try it online!






            share|improve this answer













            JavaScript (Node.js), 121 bytes



            Expects the input string in lower case.





            s=>(v=n=>2130466>>n&1)((a=Buffer(s).map(n=>(i=v(n),g=n=>n++%61?v(n)^i?g(n):n:g(96))(n)))[0],a+='')?a:a.slice(1)+a[0]+'ay'


            Try it online!







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 20 mins ago









            Arnauld

            64.2k580270




            64.2k580270




















                up vote
                1
                down vote














                R, 101 bytes



                The simple way. Now slightly less obvious.





                function(s)sub("^([^aeiou])(.*)","\2\1ay",chartr(intToUtf8(97:122),"ecdfighjoklmnpuqrstvawxyzb",s))


                Try it online!






                share|improve this answer


























                  up vote
                  1
                  down vote














                  R, 101 bytes



                  The simple way. Now slightly less obvious.





                  function(s)sub("^([^aeiou])(.*)","\2\1ay",chartr(intToUtf8(97:122),"ecdfighjoklmnpuqrstvawxyzb",s))


                  Try it online!






                  share|improve this answer
























                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote










                    R, 101 bytes



                    The simple way. Now slightly less obvious.





                    function(s)sub("^([^aeiou])(.*)","\2\1ay",chartr(intToUtf8(97:122),"ecdfighjoklmnpuqrstvawxyzb",s))


                    Try it online!






                    share|improve this answer















                    R, 101 bytes



                    The simple way. Now slightly less obvious.





                    function(s)sub("^([^aeiou])(.*)","\2\1ay",chartr(intToUtf8(97:122),"ecdfighjoklmnpuqrstvawxyzb",s))


                    Try it online!







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited 2 mins ago

























                    answered 50 mins ago









                    J.Doe

                    7219




                    7219




















                        up vote
                        1
                        down vote














                        Jelly, 25 bytes



                        ,ṙ¥1y
                        ØẹçØḄçṙḢeØḄƊ©®“ay”x


                        Try it online!



                        What am I doing? Honestly I'm questioning my sanity (really, ©®?!), this is a sneaky and probably trivial-to-outgolf solution! Only works as a full program because it's too strange... Will try to bring it to normal soon.





                        share
























                          up vote
                          1
                          down vote














                          Jelly, 25 bytes



                          ,ṙ¥1y
                          ØẹçØḄçṙḢeØḄƊ©®“ay”x


                          Try it online!



                          What am I doing? Honestly I'm questioning my sanity (really, ©®?!), this is a sneaky and probably trivial-to-outgolf solution! Only works as a full program because it's too strange... Will try to bring it to normal soon.





                          share






















                            up vote
                            1
                            down vote










                            up vote
                            1
                            down vote










                            Jelly, 25 bytes



                            ,ṙ¥1y
                            ØẹçØḄçṙḢeØḄƊ©®“ay”x


                            Try it online!



                            What am I doing? Honestly I'm questioning my sanity (really, ©®?!), this is a sneaky and probably trivial-to-outgolf solution! Only works as a full program because it's too strange... Will try to bring it to normal soon.





                            share













                            Jelly, 25 bytes



                            ,ṙ¥1y
                            ØẹçØḄçṙḢeØḄƊ©®“ay”x


                            Try it online!



                            What am I doing? Honestly I'm questioning my sanity (really, ©®?!), this is a sneaky and probably trivial-to-outgolf solution! Only works as a full program because it's too strange... Will try to bring it to normal soon.






                            share











                            share


                            share










                            answered 1 min ago









                            Mr. Xcoder

                            30.4k758193




                            30.4k758193




















                                qazwsx is a new contributor. Be nice, and check out our Code of Conduct.









                                 

                                draft saved


                                draft discarded


















                                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.













                                 


                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f172281%2fthe-improved-caesar-pig-latin-cypher%23new-answer', 'question_page');

                                );

                                Post as a guest













































































                                Comments

                                Popular posts from this blog

                                What does second last employer means? [closed]

                                Installing NextGIS Connect into QGIS 3?

                                One-line joke