# Hack the Interview V (Asia Pacific) Contest Problem

if Anyone of you guys have Solved this Recent Hackerrank Contest problem (NEW KEYBOARD)
Link - https://www.hackerrank.com/contests/hack-the-interview-v-asia-pacific/challenges/strange-keyboard-1. to the problem statement . i need Solution for this in Python 3.
Thank you

Python 3 soln.
``````def receivedText(S):
# WRITE DOWN YOUR CODE HERE
from collections import deque
FT,BK=deque(),deque()
def push():
while FT:
BK.appendleft(FT.pop())
cur=FT
NL=True
for x in S:
# print(x,FT,BK)
if x=='#':
NL=not NL
elif x=='<' or x=='>':
push()
cur=FT if x=='<' else BK
elif x=='*':
if cur:
cur.pop()
elif '0'<=x<='9':
if NL:
cur.append(x)
else:
cur.append(x)
push()
return "".join(x for x in BK)
``````

Python 3

``````from collections import deque
l=deque([])
s=input()
enable=1
point=-1
for i in range(len(s)):

if s[i]=='#':
enable=(enable+1)%2
elif s[i]=='<':
point=-1
elif s[i]=='>':
point=len(l)-1
elif s[i]=='*':
if point!=-1:
l[point]=''
point-=1
else:
if s[i].isdigit() and not enable:
continue
point+=1
l.insert(point,s[i])
print(*l,sep="")
``````

Thanks you

Thanks bro