Files
code_olymp/uts/session_py/dist_march_2k17/String.py

16 lines
295 B
Python

import sys
sys.stdin = open("input.txt", "r")
sys.stdout = open("output.txt", "w")
orig, end = input(), input()
while len(end) > len(orig):
if end[-1] == 'A':
end = end[:-1]
else:
end = end[:-1][::-1]
if orig == end:
print('POSSIBLE')
else:
print('IMPOSSIBLE')