Remove a letter to make a palindrome Problem
Let's say that a word is almost a palindrome if it is possible to remove one of its letters so that the word becomes a palindrome. Your task is to write a program that for a given word determines which letter to remove to get a palindrome.
The shortest code to do this in any programming language wins.
Input
Input consists of a word of uppercase letters from 2 to 1000 characters long.
Output
Output the 1-indexed position (leftmost letter has position 1, the next one has position 2 and so on) of the letter which should be removed. If there are possible choices that lead to the palindrome, output any of those positions. Note that you are required to remove a letter even if the given word is already a palindrome. If the given word is not almost an palindrome, output -1.

Example
The input:
racercar

might produce the output:
5

because removing the 5th letter produces racecar, which is a palindrome.
Also, the input
racecar

can still produce the output
4

because removing the 4th letter to produce raccar is still a palindrome.
Not-PHP Python (73):

[a[:g]+a[g+1:]==(a[:g]+a[g+1:])[::-1] for g in range(len(a))].index(1)


Where a is the string you want to check. This, however, throws an error if you can't turn it in an palindrome. Instead, you could use

try:print [a[:g]+a[g+1:]==(a[:g]+a[g+1:])[::-1] for g in range(len(a))].index(True)
except ValueError:print -1



EDIT: No, wait, it does work!

try: eval("&lt;?php $line = fgets(STDIN); ?&gt;")
except: print [a[:g]+a[g+1:]==(a[:g]+a[g+1:])[::-1] for g in range(len(a))].index(1)


Thanks, this does indeed raise the php-contents of this script by about 25% (that's what you want, right?)