Cody

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

Solution 705564

Submitted on 23 Jul 2015 by Gergely Patay
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 = F[fmigzySpMRrrmW>lJ7ziqsvdBm6noLxz]b3KoZFK^z2IM7ydiecYlmU4sSe;nxu@Lm8F^QZCQ9JI9=\C=XrOO4Q?BGFCn]MfMVlp\dRJcvXGd:c_j5`hu=LW5C2v[Ik:Uy?SR]og>WP8uqGC@5<KA<sx3R9pq2J?kRTC1^CAWcy?ivy77J;TN^:4\<7Ikyr=D?ZkR_ ans = 0

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

ans = Rh[lh@;bn@RdbnjIcvPWzJ32:\D1:S:zeV\5l=hd<Z83dBW^_J25Pufg3GfqlY@]m<u_@\lO?MKF3XsWC2K3YILd?ICnqYpgH_d24vXwMuyav`ND[1Q=fd74t8PMQ;ElV]8i[=aUmEesKsWIWo1gk2t]?P_r\n:HAKOcoYFjUmnde4VAICuDXt79<<BRWn6j@L88fFQttQFf88L@j6nWRB<<97tXDuCIAV4ednmUjFYocOKAH:n\r_P?]t2kg1oWIWsKseEmUa=[i8]VlE;QMP8t47df=Q1[DN`vayuMwXv42d_HgpYqnCI?dLIY3K2CWsX3FKM?Ol\@_u<m]@YlqfG3gfuP52J_^WBd38Z<dh=l5\Vez:S:1D\:23JzWPvcIjnbdR@nb;@hl[hR 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(fliplr(ans),ans) % )sna,)sna(rlpilf(lauqesi )'','s\',s(perpxeger )s(lap_si = sna noitcnuf ans = functionans=is_pal(s)regexprep(s,'\s','')isequal(fliplr(ans),ans)%)sna,)sna(rlpilf(lauqesi)'','s\',s(perpxeger)s(lap_si=snanoitcnuf ans = 1