Cody

# Problem 42461. This is a palindrome and so am I

Solution 705838

Submitted on 23 Jul 2015 by Peng Liu
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
%% s = 'a man a plan a canal panama'; assert(isequal(is_pal(s),true))

ans = amanaplanacanalpanama ans = 1

2   Pass
%% s = 'taco cat'; assert(isequal(is_pal(s),true))

ans = tacocat ans = 1

3   Pass
%% s = 'a man a plan canal panama'; assert(isequal(is_pal(s),false))

ans = amanaplancanalpanama ans = 0

4   Pass
%% s = char(randi(74,1,200)+'0'); assert(isequal(is_pal(s),false)); % most probably

ans = E:Wug9m3aHEEm_]tKBGtrirkpJp5EZskld:Wk2xHr6X]::b4\riPW>kcDV18WCry]6[6NnUE7g2tKKs52O71VCRQXR>c`_:uK=R7I8qKnnF;;karIj=:p@=clPlaF=Htobi@w9AV3FUrxFX>Al8\ZM?16<4wnW=enfN1r_[3w^u8WM?zdFxl5ojU`Igj;_7RS:1CeSiy ans = 0

5   Pass
%% s = char(randi(74,1,200)+'0'); s = [s fliplr(s)]; assert(isequal(is_pal(s),true));

ans = pmU\Hc2T2TZ9ytnr8yeSgSThQ@1>AaGX8K4us2wVRdEDu3[;jQrIo7]MY=Uen\q^y9siJeueKbnx7CQZfDC[>VZYmfaEWXSt7zUP_HGuV3EQl=GjINYtD;ucSEwKK=paM5AIyTpUdJz[1UDdzrdjTT\iN;u4L<BVdLAT\cFIK>I[Oida`pDn7\oTiQya8KCd2gniFm\\\\mFing2dCK8ayQiTo\7nDp`adiO[I>KIFc\TALdVB<L4u;Ni\TTjdrzdDU1[zJdUpTyIA5Map=KKwEScu;DtYNIjG=lQE3VuGH_PUz7tSXWEafmYZV>[CDfZQC7xnbKeueJis9y^q\neU=YM]7oIrQj;[3uDEdRVw2su4K8XGaA>1@QhTSgSey8rnty9ZT2T2cH\Ump ans = 1

6   Pass
%% s = fileread('is_pal.m'); s = regexprep(s,'%This code written by profile_id.*','') assert(isequal(is_pal(s),true));

s = function ans = is_pal(s) regexprep(s,'\s','') isequal(flip(ans),ans) % )sna,)sna(pilf(lauqesi )'','s\',s(perpxeger )s(lap_si = sna noitcnuf ans = functionans=is_pal(s)regexprep(s,'\s','')isequal(flip(ans),ans)%)sna,)sna(pilf(lauqesi)'','s\',s(perpxeger)s(lap_si=snanoitcnuf ans = 1