Cody

Solution 719257

Submitted on 21 Aug 2015 by Ian Riley
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
%% a = 'xkayakyy'; p = 'kayak'; assert(isequal(p,pal(a)));

sub = xk sub = ka sub = ay sub = ya sub = ak sub = ky sub = yy b = yy sub = xka sub = kay sub = aya b = aya sub = yak sub = aky sub = kyy sub = xkay sub = kaya sub = ayak sub = yaky sub = akyy sub = xkaya sub = kayak b = kayak sub = ayaky sub = yakyy sub = xkayak sub = kayaky sub = ayakyy sub = xkayaky sub = kayakyy sub = xkayakyy

2   Pass
%% a = '3.141592653589793238462643383279502884197169399375105820974944592307816406286'; p = '46264'; assert(isequal(p,pal(a)));

sub = 3. sub = .1 sub = 14 sub = 41 sub = 15 sub = 59 sub = 92 sub = 26 sub = 65 sub = 53 sub = 35 sub = 58 sub = 89 sub = 97 sub = 79 sub = 93 sub = 32 sub = 23 sub = 38 sub = 84 sub = 46 sub = 62 sub = 26 sub = 64 sub = 43 sub = 33 b = 33 sub = 38 sub = 83 sub = 32 sub = 27 sub = 79 sub = 95 sub = 50 sub = 02 sub = 28 sub = 88 b = 88 sub = 84 sub = 41 sub = 19 sub = 97 sub = 71 sub = 16 sub = 69 sub = 93 sub = 39 sub = 99 b = 99 sub = 93 sub = 37 sub = 75 sub = 51 sub = 10 sub = 05 sub = 58 sub = 82 sub = 20 sub = 09 sub = 97 sub = 74 sub = 49 sub = 94 sub = 44 b = 44 sub = 45 sub = 59 sub = 92 sub = 23 sub = 30 sub = 07 sub = 78 sub = 81 sub = 16 sub = 64 sub = 40 sub = 06 sub = 62 sub = 28 sub = 86 sub = 3.1 sub = .14 sub = 141 b = 141 sub = 415 sub = 159 sub = 592 sub = 926 sub = 265 sub = 653 sub = 535 b = 535 sub = 358 sub = 589 sub = 897 sub = 979 b = 979 sub = 793 sub = 932 sub = 323 b = 323 sub = 238 sub = 384 sub = 846 sub = 462 sub = 626 b = 626 sub = 264 sub = 643 sub = 433 sub = 338 sub = 383 b = 383 sub = 832 sub = 327 sub = 279 sub = 795 sub = 950 sub = 502 sub = 028 sub = 288 sub = 884 sub = 841 sub = 419 sub = 197 sub = 971 sub = 716 sub = 169 sub = 693 sub = 939 b = 939 sub = 399 sub = 993 sub = 937 sub = 375 sub = 751 sub = 510 sub = 105 sub = 058 sub = 582 sub = 820 sub = 209 sub = 097 sub = 974 sub = 749 sub = 494 b = 494 sub = 944 sub = 445 sub = 459 sub = 592 sub = 923 sub = 230 sub = 307 sub = 078 sub = 781 sub = 816 sub = 164 sub = 640 sub = 406 sub = 062 sub = 628 sub = 286 sub = 3.14 sub = .141 sub = 1415 sub = 4159 sub = 1592 sub = 5926 sub = 9265 sub = 2653 sub = 6535 sub = 5358 sub = 3589 sub = 5897 sub = 8979 sub = 9793 sub = 7932 sub = 9323 sub = 3238 sub = 2384 sub = 3846 sub = 8462 sub = 4626 sub = 6264 sub = 2643 sub = 6433 sub = 4338 sub = 3383 sub = 3832 sub = 8327 sub = 3279 sub = 2795 sub = 7950 sub = 9502 sub = 5028 sub = 0288 sub = 2884 sub = 8841 sub = 8419 sub = 4197 sub = 1971 sub = 9716 sub = 7169 sub = 1693 sub = 6939 sub = 9399 sub = 3993 b = 3993 sub = 9937 sub = 9375 sub = 3751 sub = 7510 sub = 5105 sub = 1058 sub = 0582 sub = 5820 sub = 8209 sub = 2097 sub = 0974 sub = 9749 sub = 7494 sub = 4944 sub = 9445 sub = 4459 sub = 4592 sub = 5923 sub = 9230 sub = 2307 sub = 3078 sub = 0781 sub = 7816 sub = 8164 sub = 1640 sub = 6406 sub = 4062 sub = 0628 sub = 6286 sub = 3.141 sub = .1415 sub = 14159 sub = 41592 sub = 15926 sub = 59265 sub = 92653 sub = 26535 sub = 65358 sub = 53589 sub = 35897 sub = 58979 sub = 89793 sub = 97932 sub = 79323 sub = 93238 sub = 32384 sub = 23846 sub = 38462 sub = 84626 sub = 46264 b = 46264 sub = 62643 sub = 26433 sub = 64338 sub = 43383 sub = 33832 sub = 38327 sub = 83279 sub = 32795 sub = 27950 sub = 79502 sub = 95028 sub = 50288 sub = 02884 sub = 28841 sub = 88419 sub = 84197 sub = 41971 sub = 19716 sub = 97169 sub = 71693 sub = 16939 sub = 69399 sub = 93993 sub = 39937 sub = 99375 sub = 93751 sub = 37510 sub = 75105 sub = 51058 sub = 10582 sub = 05820 sub = 58209 sub = 82097 sub = 20974 sub = 09749 sub = 97494 sub = 74944 sub = 49445 sub = 94459 sub = 44592 sub = 45923 sub = 59230 sub = 92307 sub = 23078 sub = 30781 sub = 07816 sub = 78164 sub = 81640 sub = 16406 sub = 64062 sub = 40628 sub = 06286 sub = 3.1415 sub = .14159 sub = 141592 sub = 415926 sub = 159265 sub = 592653 sub = 926535 sub = 265358 sub = 653589 sub = 535897 sub = 358979 sub = 589793 sub = 897932 sub = 979323 sub = 793238 sub = 932384 sub = 323846 sub = 238462 sub = 384626 sub = 846264 sub = 462643 sub = 626433 sub = 264338 sub = 643383 sub = 433832 sub = 338327 sub = 383279 sub = 832795 sub = 327950 sub = 279502 sub = 795028 sub = 950288 sub = 502884 sub = 028841 sub = 288419 sub = 884197 sub = 841971 sub = 419716 sub = 197169 sub = 971693 sub = 716939 sub = 169399 sub = 693993 sub = 939937 sub = 399375 sub = 993751 sub = 937510 sub = 375105 sub = 751058 sub = 510582 sub = 105820 sub = 058209 sub = 582097 sub = 820974 sub = 209749 sub = 097494 sub = 974944 sub = 749445 sub = 494459 sub = 944592 sub = 445923 sub = 459230 sub = 592307 sub = 923078 sub = 230781 sub = 307816 sub = 078164 sub = 781640 sub = 816406 sub = 164062 sub = 640628 sub = 406286 sub = 3.14159 sub = .141592 sub = 1415926 sub = 4159265 sub = 1592653 sub = 5926535 sub = 9265358 sub = 2653589 sub = 6535897 sub = 5358979 sub = 3589793 sub = 5897932 sub = 8979323 sub = 9793238 sub = 7932384 sub = 9323846 sub = 3238462 sub = 2384626 sub = 3846264 sub = 8462643 sub = 4626433 sub = 6264338 sub = 2643383 sub = 6433832 sub = 4338327 sub = 3383279 sub = 3832795 sub = 8327950 sub = 3279502 sub = 2795028 sub = 7950288 sub = 9502884 sub = 5028841 sub = 0288419 sub = 2884197 sub = 8841971 sub = 8419716 sub = 4197169 sub = 1971693 sub = 9716939 sub = 7169399 sub = 1693993 sub = 6939937 sub = 9399375 sub = 3993751 sub = 9937510 sub = 9375105 sub = 3751058 sub = 7510582 sub = 5105820 sub = 1058209 sub = 0582097 sub = 5820974 sub = 8209749 sub = 2097494 sub = 0974944 sub = 9749445 sub = 7494459 sub = 4944592 sub = 9445923 sub = 4459230 sub = 4592307 sub = 5923078 sub = 9230781 sub = 2307816 sub = 3078164 sub = 0781640 sub = 7816406 sub = 8164062 sub = 1640628 sub = 6406286 sub = 3.141592 sub = .1415926 sub = 14159265 sub = 41592653 sub = 15926535 sub = 59265358 sub = 92653589 sub = 26535897 sub = 65358979 sub = 53589793 sub = 35897932 sub = 58979323 sub = 89793238 sub = 97932384 sub = 79323846 sub = 93238462 sub = 32384626 sub = 23846264 sub = 38462643 sub = 84626433 sub = 46264338 sub = 62643383 sub = 26433832 sub = 64338327 sub = 43383279 sub = 33832795 sub = 38327950 sub = 83279502 sub = 32795028 sub = 27950288 sub = 79502884 sub = 95028841 sub = 50288419 sub = 02884197 sub = 28841971 sub = 88419716 sub = 84197169 sub = 41971693 sub = 19716939 sub = 97169399 sub = 71693993 sub = 16939937 sub = 69399375 sub = 93993751 sub = 39937510 sub = 99375105 sub = 93751058 sub = 37510582 sub = 75105820 sub = 51058209 sub = 10582097 sub = 05820974 sub = 58209749 sub = 82097494 sub = 20974944 sub = 09749445 sub = 97494459 sub = 74944592 sub = 49445923 sub = 94459230 sub = 44592307 sub = 45923078 sub = 59230781 sub = 92307816 sub = 23078164 sub = 30781640 sub = 07816406 sub = 78164062 sub = 81640628 sub = 16406286 sub = 3.1415926 sub = .14159265 sub = 141592653 sub = 415926535 sub = 159265358 sub = 592653589 sub = 926535897 sub = 265358979 sub = 653589793 sub = 535897932 sub = 358979323 sub = 589793238 sub = 897932384 sub = 979323846 sub = 793238462 sub = 932384626 sub = 323846264 sub = 238462643 sub = 384626433 sub = 846264338 sub = 462643383 sub = 626433832 sub = 264338327 sub = 643383279 sub = 433832795 sub = 338327950 sub = 383279502 sub = 832795028 sub = 327950288 sub = 279502884 sub = 795028841 sub = 950288419 sub = 502884197 sub = 028841971 sub = 288419716 sub = 884197169 sub = 841971693 sub = 419716939 sub = 197169399 sub = 971693993 sub = 716939937 sub = 169399375 sub = 693993751 sub = 939937510 sub = 399375105 sub = 993751058 sub = 937510582 sub = 375105820 sub = 751058209 sub = 510582097 sub = 105820974 sub = 058209749 sub = 582097494 sub = 820974944 sub = 209749445 sub = 097494459 sub = 974944592 sub = 749445923 sub = 494459230 sub = 944592307 sub = 445923078 sub = 459230781 sub = 592307816 sub = 923078164 sub = 230781640 sub = 307816406 sub = 078164062 sub = 781640628 sub = 816406286 sub = 3.14159265 sub = .141592653 sub = 1415926535 sub = 4159265358 sub = 1592653589 sub = 5926535897 sub = 9265358979 sub = 2653589793 sub = 6535897932 sub = 5358979323 sub = 3589793238 sub = 5897932384 sub = 8979323846 sub = 9793238462 sub = 7932384626 sub = 9323846264 sub = 3238462643 sub = 2384626433 sub = 3846264338 sub = 8462643383 sub = 4626433832 sub = 6264338327 sub = 2643383279 sub = 6433832795 sub = 4338327950 sub = 3383279502 sub = 3832795028 sub = 8327950288 sub = 3279502884 sub = 2795028841 sub = 7950288419 sub = 9502884197 sub = 5028841971 sub = 0288419716 sub = 2884197169 sub = 8841971693 sub = 8419716939 sub = 4197169399 sub = 1971693993 sub = 9716939937 sub = 7169399375 sub = 1693993751 sub = 6939937510 sub = 9399375105 sub = 3993751058 sub = 9937510582 sub = 9375105820 sub = 3751058209 sub = 7510582097 sub = 5105820974 sub = 1058209749 sub = 0582097494 sub = 5820974944 sub = 8209749445 sub = 2097494459 sub = 0974944592 sub = 9749445923 sub = 7494459230 sub = 4944592307 sub = 9445923078 sub = 4459230781 sub = 4592307816 sub = 5923078164 sub = 9230781640 sub = 2307816406 sub = 3078164062 sub = 0781640628 sub = 7816406286 sub = 3.141592653 sub = .1415926535 sub = 14159265358 sub = 41592653589 sub = 15926535897 sub = 59265358979 sub = 92653589793 sub = 26535897932 sub = 65358979323 sub = 53589793238 sub = 35897932384 sub = 58979323846 sub = 89793238462 sub = 97932384626 sub = 79323846264 sub = 93238462643 sub = 32384626433 sub = 23846264338 sub = 38462643383 sub = 84626433832 sub = 46264338327 sub = 62643383279 sub = 26433832795 sub = 64338327950 sub = 43383279502 sub = 33832795028 sub = 38327950288 sub = 83279502884 sub = 32795028841 sub = 27950288419 sub = 79502884197 sub = 95028841971 sub = 50288419716 sub = 02884197169 sub = 28841971693 sub = 88419716939 sub = 84197169399 sub = 41971693993 sub = 19716939937 sub = 97169399375 sub = 71693993751 sub = 16939937510 sub = 69399375105 sub = 93993751058 sub = 39937510582 sub = 99375105820 sub = 93751058209 sub = 37510582097 sub = 75105820974 sub = 51058209749 sub = 10582097494 sub = 05820974944 sub = 58209749445 sub = 82097494459 sub = 20974944592 sub = 09749445923 sub = 97494459230 sub = 74944592307 sub = 49445923078 sub = 94459230781 sub = 44592307816 sub = 45923078164 sub = 59230781640 sub = 92307816406 sub = 23078164062 sub = 30781640628 sub = 07816406286 sub = 3.1415926535 sub = .14159265358 sub = 141592653589 sub = 415926535897 sub = 159265358979 sub = 592653589793 sub = 926535897932 sub = 265358979323 sub = 653589793238 sub = 535897932384 sub = 358979323846 sub = 589793238462 sub = 897932384626 sub = 979323846264 sub = 793238462643 sub = 932384626433 sub = 32384626...

3   Fail
%% a = 'truly I say: able was I ere I saw elba, but that is another story'; p = 'able was I ere I saw elba'; assert(isequal(p,pal(a)));

sub = tr sub = ru sub = ul sub = ly sub = y sub = I sub = I sub = s sub = sa sub = ay sub = y: sub = : sub = a sub = ab sub = bl sub = le sub = e sub = w sub = wa sub = as sub = s sub = I sub = I sub = e sub = er sub = re sub = e sub = I sub = I sub = s sub = sa sub = aw sub = w sub = e sub = el sub = lb sub = ba sub = a, sub = , sub = b sub = bu sub = ut sub = t sub = t sub = th sub = ha sub = at sub = t sub = i sub = is sub = s sub = a sub = an sub = no sub = ot sub = th sub = he sub = er sub = r sub = s sub = st sub = to sub = or sub = ry sub = tru sub = rul sub = uly sub = ly sub = y I sub = I b = I sub = I s sub = sa sub = say sub = ay: sub = y: sub = : a sub = ab sub = abl sub = ble sub = le sub = e w sub = wa sub = was sub = as sub = s I sub = I b = I sub = I e sub = er sub = ere b = ere sub = re sub = e I sub = I b = I sub = I s sub = sa sub = saw sub = aw sub = w e sub = el sub = elb sub = lba sub = ba, sub = a, sub = , b sub = bu sub = but sub = ut sub = t t b = t t sub = th sub = tha sub = hat sub = at sub = t i sub = is sub = is sub = s a sub = an sub = ano sub = not sub = oth sub = the sub = her sub = er sub = r s sub = st sub = sto sub = tor sub = ory sub = trul sub = ruly sub = uly sub = ly I sub = y I sub = I s sub = I sa sub = say sub = say: sub = ay: sub = y: a sub = : ab sub = abl sub = able sub = ble sub = le w sub = e wa sub = was sub = was sub = as I sub = s I sub = I e sub = I er sub = ere sub = ere sub = re I sub = e I sub = I s sub = I sa sub = saw sub = saw sub = aw e sub = w el sub = elb sub = elba sub = lba, sub = ba, sub = a, b sub = , bu sub = but sub = but sub = ut t sub = t th sub = tha sub = that sub = hat sub = at i sub = t is sub = is sub = is a sub = s an sub = ano sub = anot sub = noth sub = othe sub = ther sub = her sub = er s sub = r st sub = sto sub = stor sub = tory sub = truly sub = ruly sub = uly I sub = ly I sub = y I s sub = I sa sub = I say sub = say: sub = say: sub = ay: a sub = y: ab sub = : abl sub = able sub = able sub = ble w sub = le wa sub = e was sub = was sub = was I sub = as I sub = s I e sub = I er sub = I ere sub = ere b = ere sub = ere I sub = re I sub = e I s sub = I sa sub = I saw sub = saw sub = saw e sub = aw el sub = w elb sub = elba sub = elba, sub = lba, sub = ba, b sub = a, bu sub = , but sub = but sub = but t sub = ut th sub = t tha sub = that sub = that sub = hat i sub = at is sub = t is sub = is a sub = is an sub = s ano sub = anot sub = anoth sub = nothe sub = other sub = ther sub = her s sub = er st sub = r sto sub = stor sub = story sub = truly sub = ruly I sub = uly I sub = ly I s sub = y I sa sub = I say sub = I say: sub = say: sub = say: a sub = ay: ab sub = y: abl sub = : able sub = able sub = able w sub = ble wa sub = le was sub = e was sub = was I sub = was I sub = as I e sub = s I er sub = I ere sub = I ere sub = ere I sub = ere I sub = re I s sub = e I sa sub = I saw sub = I saw sub = saw e sub = saw el sub = aw elb sub = w elba sub = elba, sub = elba, sub = lba, b sub = ba, bu sub = a, but sub = , but sub = but t sub = but th sub = ut tha sub = t that sub = that sub = that i sub = hat is sub = at is sub = t is a sub = is an sub = is ano sub = s anot sub = anoth sub = anothe sub = nother sub = other sub = ther s sub = her st sub = er sto sub = r stor sub = story sub = truly I sub = ruly I sub = uly I s sub = ly I sa sub = y I say sub = I say: sub = I say: sub = say: a sub = say: ab sub = ay: abl sub = y: able sub = : able sub = able w sub = able wa sub = ble was sub = le was sub = e was I sub = was I sub = was I e sub = as I er sub = s I ere sub = I ere sub = I ere I b = I ere I sub = ere I sub = ere I s sub = re I sa sub = e I saw sub = I saw sub = I saw e sub = saw el sub = saw elb sub = aw elba sub = w elba, sub = elba, sub = elba, b sub = lba, bu sub = ba, but sub = a, but sub = , but t sub = but th sub = but tha sub = ut that sub = t that sub = that i sub = that is sub = hat is sub = at is a sub = t is an sub = is ano sub = is anot sub = s anoth sub = anothe sub = another sub = nother sub = other s sub = ther st sub = her sto sub = er stor sub = r story sub = truly I sub = ruly I s sub = uly I sa sub = ly I say sub = y I say: sub = I say: sub = I say: a sub = say: ab sub = say: abl sub = ay: able sub = y: able sub = : able w sub = able wa sub = able was sub = ble was sub = le was I sub = e was I sub = was I e sub = was I er sub = as I ere sub = s I ere sub = I ere I sub = I ere I sub = ere I s sub = ere I sa sub = re I saw sub = e I saw sub = I saw e sub = I saw el sub = saw elb sub = saw elba sub = aw elba, sub = w elba, sub = elba, b sub = elba, bu sub = lba, but sub = ba, but sub = a, but t sub = , but th sub = but tha sub = but that sub = ut that sub = t that i sub = that is sub = that is sub = hat is a sub = at is an sub = t is ano sub = is anot sub = is anoth sub = s anothe sub = another sub = another sub = nother s su