Cody

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

Solution 705918

Submitted on 23 Jul 2015 by Tim
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 = @G=yUHSHqkwv_AGlTfO;;`<v3CGyb3;whpfRBc5Q1tVM`2z=oNpna8eE=mTXgSiLs]anj_^in=xaI<fJbJNM@ak8MxRR\6CVUcAo8\o[74jJFLtaSQ\>nWI3RZoK1KA5\TxNvIvP?kTNJb\hvzlfiMd:p6NJJl56IVTOMr;hZ3I]@wZ?t@]qWGaejTi;MGlCJPI^B8sZ ans = 0

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

ans = 6o[8\=9ylD9wTOwYDBJ\PBpbVGd5nhUTa;_QKGV>1[Ya:G3lCNIo>hZGxTzI_TQK?6i4j]3`y[mFXaw9>[8Cj?fR3vPJwK9Gyc3MXUuQ7@3Mov^>W>kpqjA:iZy19YzLMcF]y1:_a3?PBVt[XdTPF[VS1lDKmf:oASN7>KMjbT8b_\D\4t4RwL59\T7d_FLkpUHTmI9yy9ImTHUpkLF_d7T\95LwR4t4\D\_b8TbjMK>7NSAo:fmKDl1SV[FPTdX[tVBP?3a_:1y]FcMLzY91yZi:Ajqpk>W>^voM3@7QuUXM3cyG9KwJPv3Rf?jC8[>9waXFm[y`3]j4i6?KQT_IzTxGZh>oINCl3G:aY[1>VGKQ_;aTUhn5dGVbpBP\JBDYwOTw9Dly9=\8[o6 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) % s(~isspace(s)) % isequal(ans,fliplr(ans))% %))sna(rlpilf,sna(lauqesi % ))s(ecapssi~(s % )s(lap_si=sna noitcnuf ans = functionans=is_pal(s)%s(~isspace(s))%isequal(ans,fliplr(ans))%%))sna(rlpilf,sna(lauqesi%))s(ecapssi~(s%)s(lap_si=snanoitcnuf ans = 1