#31755: python可以幫我看看嗎?


yuxuan0912 (李毓萱Laura)


while True:
    try:
        t,n=list(map(int,input().split()))
        stri=""
        for i in range(t):
            stri=(stri+input())
        x=list(map(int,input().split()))
        for j in x:
            print(stri[j-1],end='')
        k=input()
    except EOFError:
        break

#31804: Re: python可以幫我看看嗎?


cges30901 (cges30901)



  1.         for j in x:
                print(stri[j-1],end='')

  2.         k=input()

  1. 全部輸出完要換行
  2. 這行刪掉
#32228: Re: python可以幫我看看嗎?


yuxuan0912 (李毓萱Laura)



  1.         for j in x:
                print(stri[j-1],end='')

  2.         k=input()

  1. 全部輸出完要換行
  2. 這行刪掉

感謝