Cody

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

Solution 2745889

Submitted on 27 Jul 2020
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?' word = 'sky' word = 'kysay' word = 'is' word = 'siay' word = 'falling' word = 'allingfay' word = 'the' word = 'hetay' word = 'sky' word = 'kysay' word = 'is' word = 'siay' word = 'falling' word = 'allingfay' word = 'or' word = 'roay' word = 'is' word = 'siay' output = '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?' word = 'Allen' word = 'is' word = 'siay' word = 'Janes' word = 'husband' word = 'usbandhay' word = 'and' word = 'ndaay' word = 'Tom' word = 'is' word = 'siay' word = 'Jill' word = 'husband' word = 'usbandhay' word = 'who' word = 'howay' word = 'is' word = 'siay' word = 'Roys' output = 'Fiay Llenaay siay Anesjay usbandhay ndaay Omtay siay Illjay usbandhay, howay siay Oysray ifeway?'

3   Fail
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.' word = 'is' word = 'siay' word = 'the' word = 'hetay' word = 'sentence' word = 'entencesay' word = 'I'

Index exceeds the number of array elements (1). Error in backslang (line 11) word=[upper(word(2)) word(3:end) lower(word(1)) 'ay']; Error in Test3 (line 3) assert(isequal(backslang(str),output))

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!' word = 'Columbus' word = 'sailed' word = 'ailedsay' word = 'the' word = 'hetay' word = 'ocean' word = 'ceanoay' output = '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!