All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > General > Word Problems
Some special states (Posted on 2024-02-06) Difficulty: 3 of 5
What US States (defined by a single word) contain each within its name a four letter palindromic sequence, like ABBA)?

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 6
fid=fopen('c:\VB5 Projects\flooble\STATES~1.TXT','r');
while ~feof(fid)
  state=fgetl(fid);
  state=lower(strtrim(state(1:21)));
  if ~contains(state,' ')
    for a=1:length(state)-3
      if isPalin(state(a:a+3))
        disp(state)
        break
      end
    end
  end
end
fclose('all');

function t=isPalin(x)
  t=true;
  for i=1:floor(length(x)/2)
    if x(i)~=x(length(x)+1-i)
      t=false;
      break
    end
  end
end

finds

>> someSpecialStates
illinois
massachusetts
mississippi
tennessee
>> 

  Posted by Charlie on 2024-02-06 19:09:16
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information