Negative indexing

Characters of strings can be accessed with [] brackets and the indexing starts with 0.
To access the last character of a string s, we can write s[len(s) - 1]. This might become messy with larger expressions and luckily there is a more concise way of accessing characters from the end through negative indexing:
#           01234     => 5 characters
greeting = 'hello'
print(greeting[len(greeting) - 1])   # o
print(greeting[len(greeting) - 2])   # l
print(greeting[len(greeting) - 3])   # l
#           01234
greeting = 'hello'
print(greeting[-1])   # o
print(greeting[-2])   # l
print(greeting[-3])   # l
Both of these programs are equivalent but the second one is more concise and easier to read.

Challenge

You are working in the security department and they ask you to add another check for user passwords. The passwords are considered secure if the first 3 letters together are not equal to the last 3 letters (in reverse order).
The input contains a single line - the password.
The program should print secure if the password is considered secure, and not secure otherwise.
Input
Output
abcdcba
not secure
treqsd97
secure
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue