Cody

# Problem 75. Find the palindrome

Solution 483474

Submitted on 6 Aug 2014 by Pascal Geschwill
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)));

inv = yykayakx first = Empty matrix: 0-by-1 last = Empty matrix: 0-by-1 first = 1 last = 1 first = 4 last = 4 first = 2 last = 2 first = Empty matrix: 0-by-1 last = Empty matrix: 0-by-1 first = 3 last = 3 first = 7 last = 8 first = 2 last = 6

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

inv = 682604618703295449479028501573993961791488205972383346264832397985356295141.3 first = 14 last = 14 first = 1 last = 1 first = 9 last = 9 first = 2 last = 2 first = 13 last = 13 first = 8 last = 9 first = 25 last = 25 first = 3 last = 5 first = 33 last = 34 first = 5 last = 5 first = 23 last = 23 first = 31 last = 32 first = 34 last = 36 first = 7 last = 7 first = 26 last = 26 first = 45 last = 48 first = 47 last = 47 first = 29 last = 30 first = 32 last = 33 first = 1 last = 1 first = 23 last = 24 first = 10 last = 12 first = 7 last = 7 first = 12 last = 12 first = 4 last = 4 first = 8 last = 8 first = 1 last = 1 first = 1 last = 1 first = 4 last = 4 first = 14 last = 16 first = 8 last = 9 first = 16 last = 16 first = 9 last = 9 first = 17 last = 17 first = 36 last = 36 first = 17 last = 19 first = 11 last = 11 first = 8 last = 8 first = 6 last = 7 first = 11 last = 11 first = 13 last = 13 first = 3 last = 4 first = 59 last = 61 first = 5 last = 5 first = 3 last = 3 first = 21 last = 25 first = 5 last = 5 first = 18 last = 20 first = 1 last = 1 first = 13 last = 13 first = 7 last = 7 first = 9 last = 9 first = 26 last = 27 first = 3 last = 3 first = 26 last = 26 first = 27 last = 29 first = 20 last = 20 first = 14 last = 14 first = 6 last = 6 first = 10 last = 10 first = 14 last = 14 first = 16 last = 17 first = 4 last = 4 first = 7 last = 7 first = 4 last = 4 first = 4 last = 4 first = 1 last = 1 first = 34 last = 34 first = 6 last = 6 first = 35 last = 35 first = 7 last = 7 first = 31 last = 32 first = 15 last = 16 first = 14 last = 14 first = 5 last = 5 first = 4 last = 4 first = 11 last = 11

3   Pass
%% 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)));

inv = yrots rehtona si taht tub ,able was I ere I saw elba :yas I ylurt first = 2 last = 2 first = 1 last = 1 first = 8 last = 8 first = 2 last = 2 first = 5 last = 5 first = 3 last = 3 first = 21 last = 21 first = 4 last = 4 first = 22 last = 22 first = 5 last = 5 first = 11 last = 11 first = 6 last = 6 first = 18 last = 18 first = 6 last = 8 first = 28 last = 28 first = 5 last = 5 first = 21 last = 22 first = 9 last = 9 first = 6 last = 6 first = 26 last = 27 first = 8 last = 8 first = 11 last = 11 first = 43 last = 45 first = 6 last = 6 first = 26 last = 26 first = 8 last = 8 first = 31 last = 31 first = 44 last = 45 first = 34 last = 34 first = 6 last = 10 first = 13 last = 13 first = 8 last = 8 first = 49 last = 49 first = 6 last = 6 first = 13 last = 13 first = 6 last = 8 first = 13 last = 13 first = 8 last = 8 first = 44 last = 44 first = 4 last = 4 first = 13 last = 13 first = 17 last = 18 first = 13 last = 13 first = 1 last = 1 first = 3 last = 3 first = 22 last = 24 first = 51 last = 52 first = 8 last = 8 first = 1 last = 1 first = 6 last = 6 first = 58 last = 58 first = 14 last = 38 first = 55 last = 56 first = 24 last = 24 first = 6 last = 6 first = 15 last = 15 first = 1 last = 1 first = 28 last = 30 first = 62 last = 62 first = 8 last = 9 first = 2 last = 2 first = 27 last = 28 first = 1 last = 1 first = 24 last = 24 first = 13 last = 13