Cody

# Problem 1721. Backslang, odds are you used it at some point in time...

Solution 284354

Submitted on 18 Jul 2013 by Tobias Schäfer
• Size: 12
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% str = 'The sky is falling, the sky is falling, or is it?' output = 'Hetay kysay siay allingfay, hetay kysay siay allingfay, roay siay tiay?' assert(isequal(backslang(str),output))

str = The sky is falling, the sky is falling, or is it? output = Hetay kysay siay allingfay, hetay kysay siay allingfay, roay siay tiay? [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] ans = Hetay kysay siay allingfay, hetay kysay siay allingfay, roay siay tiay?

2   Pass
%% str = 'If Allen is Janes husband and Tom is Jill husband, who is Roys wife?' output = 'Fiay Llenaay siay Anesjay usbandhay ndaay Omtay siay Illjay usbandhay, howay siay Oysray ifeway?' assert(isequal(backslang(str),output))

str = If Allen is Janes husband and Tom is Jill husband, who is Roys wife? output = Fiay Llenaay siay Anesjay usbandhay ndaay Omtay siay Illjay usbandhay, howay siay Oysray ifeway? [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] ans = Fiay Llenaay siay Anesjay usbandhay ndaay Omtay siay Illjay usbandhay, howay siay Oysray ifeway?

3   Pass
%% str = 'This is the sentence I will use.' output = 'Histay siay hetay entencesay Iay illway seuay.' assert(isequal(backslang(str),output))

str = This is the sentence I will use. output = Histay siay hetay entencesay Iay illway seuay. [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] ans = Histay siay hetay entencesay Iay illway seuay.

4   Pass
%% str = 'Christopher Columbus sailed the ocean blue!' output = 'Hristophercay Olumbuscay ailedsay hetay ceanoay luebay!' assert(isequal(backslang(str),output))

str = Christopher Columbus sailed the ocean blue! output = Hristophercay Olumbuscay ailedsay hetay ceanoay luebay! [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] [Warning: Colon operands should not be logical.] [> In @(token_2,token_1)[char(token_2(1:isempty(token_1))),char(token_2(1)-32*(token_1>64&token_1<91)),token_2(2:end),lower(token_1),'ay'] In backslang at 3 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14 In workspacefunc at 7] ans = Hristophercay Olumbuscay ailedsay hetay ceanoay luebay!

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!