could be done with a single regexprep if there was more fine-tuned control of the 'preservecase' keyword
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?
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?
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.
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!
ans =
Hristophercay Olumbuscay ailedsay hetay ceanoay luebay!
|
6719 Solvers
Given two strings, find the maximum overlap
461 Solvers
329 Solvers
Rotate input square matrix 90 degrees CCW without rot90
380 Solvers
Find nearest prime number less than input number
268 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!