TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N=int(input())
S=[input() for i in range(N)]
print(S)
ans='Yes'
if len(set(S))!=N:
    ans='No'
for i in range(N-1):
    if S[i][-1]!=S[i+1][0]:
        ans='No'
print(ans)

N=int(input())
S=[input() for i in range(N)]
ans='Yes'
if len(set(S))!=N:
    ans='No'
for i in range(N-1):
    if S[i][-1]!=S[i+1][0]:
        ans='No'
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())
past = []
last = ""
for i in range(N):
    W = input()
    print("past:", past)
    print("W[0]:", W[0])
    print("last[-1]:", last[-1:])
    if last == "":
        past.append(W)
        last = W
    elif W in past or W[0] != last[-1:]:
        print("No")
        exit()
    else:
        past.append(W)
        last = W
print("Yes")


N = int(input())
past = []
last = ""
Success = True
for i in range(N):
    W = input()
    # print("past:", past)
    # print("W[0]:", W[0])
    
    if last == "":
        past.append(W)
        last = W
    elif W in past or W[0] != last[-1:]:
        Success = False
    else:
        past.append(W)
        last = W

if Success == True:
    print("Yes")
else:
    print("No")


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
import sys
import collections

N = int(input())
List = [list(input()) for i in range(N)]
tmp = []

for i in range(1,N-1):
    if (List[i][0] != List[i-1][-1]):
        print('No')
        sys.exit()
    tmp.append(str(List[i]))


List_dict = collections.Counter(tmp)
for i,j in List_dict.items():
    if j != 1:
        print('No')
        sys.exit()
print('Yes')

import sys
N = int(input())
List = [list(input()) for i in range(N)]

for i in range(1,N-1):
    if (List[i][0] != List[i-1][-1]):
        print('No')
        sys.exit()

print('Yes')

import sys
import collections

N = int(input())
List = [list(input())]
for i in range(1,N):
    tmp = list(input())
    if (tmp in List) == True:
        print('No')
        sys.exit()
    List.append(list(tmp))
    
    if tmp[0] != List[i-1][-1]:
        print('No')
        sys.exit()


print('Yes')

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
import collecions

N = int(input())
W = [input() for i in range(N)]
c = collecions.Counter(W)

for i in range(N-1):
    if W[i][-1] != W[i+1][1]:
        print("No")
        exit()
if len(c) != N:
    print("No")
    exit()
print("Yes")

import collections

N = int(input())
W = [input() for i in range(N)]
c = collections.Counter(W)

for i in range(N-1):
    if W[i][-1] != W[i+1][0]:
        print("No")
        exit()
if len(c) != N:
    print("No")
    exit()
print("Yes")

Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())

appeared = []
prev = input()
for i in range(N-1):
    S = input()
    if prev[-1] != S[0] or S in appeared:
        print('No')
        exit()
    prev = S
    appeared += [S]
print('Yes')


N = int(input())

appeared = []
prev = input()
for i in range(N-1):
    appeared += [prev]
    S = input()
    if prev[-1] != S[0] or S in appeared:
        print('No')
        exit()
    prev = S
print('Yes')


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n = int(input())
sl = [input() for _ in [0]*n]
ans = 'Yes'
for i in range(1,n):
  if sl[i-1][-1] != sl[i][0]:
    ans = 'No'
print(ans)

n = int(input())
sl = [input() for _ in [0]*n]
ans = 'Yes'
for i in range(1,n):
  if sl[i-1][-1] != sl[i][0] or sl.count(sl[i]) != 1 :
    ans = 'No'
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n = int(input())
word = []
for i in range(n):
	word.append(input())

if is_unique(word) == False:
	print("No")
	exit()

for i in range(1,len(word)):
	if word[i-1][-1] != word[i][0]:
		print("No")
		exit()

print("Yes")

n = int(input())
word = []
for i in range(n):
	word.append(input())

if is_unique(word) == False:
	print("No")
	exit()

for i in range(1,len(word)):
	if word[i-1][-1] != word[i][-1]:
		print("No")
		exit()

print("Yes")

n = int(input())
word = []
for i in range(n):
	word.append(input())

if len(word) != len(set(word)):
	print("No")
	exit()

for i in range(1,len(word)):
	if word[i-1][-1] != word[i][0]:
		print("No")
		exit()

print("Yes")

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n=int(input())
l=[list(input())]
b=True
for i in range(n-1):
  w=list(input())
  if l[-1][-1]==w[0]:
    l.append(w)
  else:
    b=False
    break
if len(set(l))=n and b==True:
  print("Yes")
else:
  print("No")
  

  

i=int(input())
l=[]
c=True
for k in range(1,i+1):
  l.append(list(input())
if len(l)==len(set(l)):
  for k in range(0,i):
    if l[k][-1]!=l[k+1][0]:
       c=False
       break
else:
  c=False
if c==False:
  print("No")
else:
  print("Yes")
           
  


n=int(input())
l=[list(input())]
b=True
for i in range(n-1):
  w=list(input())
  if l[-1][-1]==w[0]:
    l.append(w)
  else:
    b=False
    break
if len(set(l))==n and b==True:
  print("Yes")
else:
  print("No")
  

  


i=int(input())
l=[]
c=True
for k in range(1,i+1):
  l.append(list(input())
if len(l)==set(l):
  for k in range(0,i):
    if l[k][-1]!=l[k+1][0]:
       c=False
       break
else:
  c=False
if c==False:
  print("No")
else:
  print("Yes")
           
  

n=int(input())
b=True
l=[]
w=input()
l.append(w)
for i in range(n-1):
  w=input()
  if w in l or w[0]!=l[-1][-1]:
    b=False
    break
  else:
    l.append(w)
if b:
  print("Yes")
else:
  print("No")
    

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n=int(input())
a=[]
for i in range(n):
    a.append(input())
flag=0
for i in range(n):
   s=a[i]
    
   if i==0:
       continue
   else:
       if last!=a[i][len(a[i])-1]:
           flag=1
           
   last=a[i][len(a[i])-1]
if flag==1:
    print("No")
else:
    print("Yes")

n=int(input())
a=[]
for i in range(n):
    a.append(input())
b=[]
flag=0
for i in range(n):
    s=a[i]
    if i!=0:
        if s[0]!=last:
            flag=1
    last=s[len(s)-1]
    if s in b:
        flag=1
        break
    b.append(s)
    
    
if flag==1:
    print("No")
else:
    print("Yes")

        
    

Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
import sys
n=int(input())
w=[input() for i in range(n)]
if all(w[j][len(w[j])]==w[j+1][0] for j in range(n-1)) and len(set(w))==n:
  print('Yes')
  sys.exit()
print('No')

import sys
n=int(input())
w=[input() for i in range(n)]
if all(w[j][len(w[j])-1]==w[j+1][0] for j in range(n-1)) and len(set(w))==n:
  print('Yes')
  sys.exit()
print('No')


Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())
word = []
flag = True
word.append(input())
for _ in range(N - 1):
    w = input()
    if w in word:
        flag = False
    elif word[-1][-1] != w[0]:
        flag = False
    else:
        word.append(w)

if flag:
    print('YES')
else:
    print('NO')


N = int(input())
word = []
flag = True
word.append(input())
for _ in range(N - 1):
    w = input()
    if w in word:
        flag = False
    elif word[-1][-1] != w[0]:
        flag = False
    else:
        word.append(w)

if flag:
    print('Yes')
else:
    print('No')


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N=int(input())
L=[]
count=0
for i in range (N):
	L.append(int(input()))
if len(set(L))!=N:
	print("No")
else:
	for i in range (N-1):
		if L[i][-1]!=L[i+1][0]:
			count+=1
	if count==0:
		print("Yes")
	else:
		print("No")

N=int(input())
L=[]
count=0
for i in range(N):
	L.append(input())
M=len(set(L))
for i in range(N-1):
	if L[i][-1]==L[i+1][0]:
		count+=1
if M==N and count==N-1:
	print("Yes")
else:
	print("No")

Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
import sys

a = []
for line in sys.stdin:
    a.append(int(line))
N = len(a)
count = 0
flag = True
for i in range(N):
    a_i = a[i]
    a_ii = a[i+1]
    if ai[-1] != a_ii[0]:
        flag = None
        break
    for j in range(i+1, N):
        if a[i] == a[j]:
            flag = None
            break
if flag:
    print('Yes')
else:
    print('No')

N = int(input())
a = []
for i in range(N):
    a.append(input())
flag = True
for j in range(N-1):
    a_i = a[j]
    a_ii = a[j+1]
    if a_i[-1] != a_ii[0]:
        flag = None
        break
    for k in range(j+1, N):
        if a[j] == a[k]:
            flag = None
            break
if flag:
    print('Yes')
else:
    print('No')

Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())
shiri = []
flag = 0
for i in range(N):
    tugi = str(input())
    tlist = list(tugi)
    if i!=0:
        if tugi in shiri:
            flag = 1
            break
        else:
            mae = list(shiri[i-1])
            if tlist[0]!=mae[-1]:
                flag = 1
                break
            else:
                shiri,append(tugi)
    else:
        shiri.append(tugi)
if flag == 0:
    print("Yes")
else:
    print("No")

N = int(input())
shiri = []
for i in range(N):
    tugi = str(input())
    tlist = list(tugi)
    if i!=0:
        if tugi in shiri:
            break
        else:
            mae = list(shiri[i-1])
            if tlist[0]!=mae[-1]:
                break
            else:
                shiri,append(tugi)
    else:
        shiri.append(tugi)

N = int(input())
shiri = []
flag = 0
for i in range(N):
    tugi = str(input())
    tlist = list(tugi)
    if i!=0:
        if tugi in shiri:
            flag = 1
            break
        else:
            mae = list(shiri[i-1])
            if tlist[0]!=mae[-1]:
                flag = 1
                break
            else:
                shiri.append(tugi)
    else:
        shiri.append(tugi)
if flag == 0:
    print("Yes")
else:
    print("No")

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())
A = []
for i in range(N):
   A.append(input())

for i in range(N-1):
     S = 0
     if A[i][-1] == A[i+1][0]:
        S += 1
for i in range(N):
  for j in range(N):
    if i != j:
      if A[i] == A[j]:
        A == 1
      else:
        A == 0

if S == 1 and A == 0:
  print('Yes')
else:

N = int(input())
A = []
for i in range(N):
   A.append(input())
S = 0
for i in range(N-1):
    if A[i][-1] == A[i+1][0]:
        S += 1
B = 0
for i in range(N):
    for j in range(N):
        if A[i] == A[j]:
            B += 1
            else:
                B += 0

if S == N-1 and B == N:
    print('Yes')
else:
    print('No')

N = int(input())
A = []
for i in range(N):
   A.append(input())
S = 0
for i in range(N-1):
    if A[i][-1] == A[i+1][0]:
        S += 1

for i in range(N):
    for j in range(N):
        if i != j:
            if A[i] == A[j]:
                B = 1
            else:
                B = 0

if S == N-1 and B == 0:
    print('Yes')
else:
    print('No')

N = int(input())
A = []
for i in range(N):
   A.append(input())
S = 0
for i in range(N-1):
    if A[i][-1] == A[i+1][0]:
        S += 1
B = 0
for i in range(N):
    for j in range(N):
        if A[i] == A[j]:
            B += 1
        else:
            B += 0

if S == N-1 and B == N:
    print('Yes')
else:
    print('No')

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n=int(input())
w=[input() for _ in range(n)]

if len(set(w))!=len(w):
  print("No")
else:
  for i in range(1,n):
    if w[i][0]!=w[i-1][-1]:
      print("No")
      exit()

print("Yes")

n=int(input())
w=[input() for _ in range(n)]

if len(set(w))!=len(w):
  print("No")
else:
  for i in range(1,n):
    if w[i][0]!=w[i-1][-1]:
      print("No")
      exit()
      
  print("Yes")

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
flag=True
for i in range(n):
    w.append(input())
    
for i in range(n-1):
    if w[i][-1]!=w[i+1][0]:
        #print(i,"out1")
        flag=False

for i in range(n-1):
    for j in range(i+1,n):
        if(w[i]==w[j]):
            #print(i,j,"out2")
            flag=False

if flag==True:
    print("Yes")
else:
    print("No")




n=int(input())
w=[]
flag=True
for i in range(n):
    w.append(input())
    
for i in range(n-1):
    if w[i][-1]!=w[i+1][0]:
        #print(i,"out1")
        flag=False

for i in range(n-1):
    for j in range(i+1,n):
        if(w[i]==w[j]):
            #print(i,j,"out2")
            flag=False

if flag==True:
    print("Yes")
else:
    print("No")




Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())

shiritori_set = set()

shiritori = input()
head = shiritori[len(shiritori) -1]

ans = "Yes"

for i in range(N-1):
  shiritori = input()
  if (shiritori[0] == head and shiritori not in shiritori_set):
    head = shiritori[len(shiritori)-1]
    shiritori_set.add(shiritori)
    continue
  else:
    ans = "No"
    break

print(ans)


  
  

N = int(input())

shiritori_set = set()

shiritori = input()
head = shiritori[len(shiritori) -1]

ans = "Yes"

for i in range(N-1):
  shiritori = input()
  if (shirotori[0] == head and shiritori in shiritori_set):
    head = shiritori[len(shiritori)-1]
    shiritori_set.add(shiritori)
    continue
  else:
    ans = "No"
    break

print(ans)


  
  

N = int(input())

shiritori_set = set()

shiritori = input()
head = shiritori[len(shiritori) -1]

ans = "Yes"
shiritori_set.add(shiritori)
for i in range(N-1):
  shiritori = input()
  if shiritori[0] == head and shiritori not in shiritori_set:
    head = shiritori[len(shiritori)-1]
    shiritori_set.add(shiritori)
  else:
    ans = "No"
    break

print(ans)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())
ws = [input()]

flg = True
for i in range(N-1):
    Wi = input()
    if Wi in ws:
        flg = False
    elif ws[-1] != Wi[0]:
        flg = False
    ws.append(Wi)



N = int(input())
ws = [input()]

flg = True
for i in range(N-1):
    Wi = input()
    if Wi in ws:
        flg = False
    elif ws[-1][-1] != Wi[0]:
        flg = False
    ws.append(Wi)

if flg:
    print("Yes")
else:
    print("No")

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n=int(input())
a=input()
b=a[len(a)-1]
word1=[a]
word2=[b]
c=0

for i in range(n-1):
    aa=input()
    bb=aa[0]
    if aa not in word1 and word2[i]==bb:
        word1.append(aa)
        top=aa[len(aa)-1]
        word2.append(top)
    else:
        c=1
        
print("Yes" if c==0 else "No")

n=int(input())
a=input()
b=a[len(a)-1]
word1=[a]
word2=[b]
c=0

for i in range(n-1):
    aa=input()
    bb=aa[0]
    if aa not in word1 and word2[i]==bb:
        word1.append(aa)
        top=aa[len(aa)-1]
        word2.append(top)
    else:
        c=1
        break
        
print("Yes" if c==0 else "No")

Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n=int(input())
w=[input() for i in range(n)]
flag=True
for s in w:
    if w.count(s) > 1:
        flag = False
for i in range(1,n)
    if w[i][0] != w[i-1][len(w[i-1])-1]:
        flag = False
print("Yes" if flag else "No")


n=int(input())
w=[input() for i in range(n)]
flag=True
for s in w:
    if w.count(s) > 1:
        flag = False
for i in range(1,n)
    if list(w[i])[0] != reversed(list(w[i-1]))[0]:
        flag = False
print("Yes" if flag else "No")

n = int(input())
s = [input() for i in range(n)]
if len(set(s)) < n:
	print("No")
else:
	flag = True
	for i in range(1,n):
		if s[i-1][-1] != s[i][0]:
			flag = False
	print("Yes" if flag else "No")

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n = int(input())
word_list = []
flag = True
for i in range(n):
    word = input()
    if word_list == []:
        word_list.append(word)
    else:
        if word_list[-1][-1] == word[0]:
            word_list.append(word)
        else:
            flag = False
            break
            
if flag:
    print('Yes')
else:
    print('No')

n = int(input())
word_list = []
flag = True
for i in range(n):
    word = input()
    if word_list == []:
        word_list.append(word)
    else:
        if (word_list[-1][-1] == word[0]) and (word not in word_list):
            word_list.append(word)
        else:
            flag = False
            break
            
if flag:
    print('Yes')
else:
    print('No')

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())
word = [input() for _ in range(N)]
s = set(word)
if len(s) != N:
  print('No')
  exit
ok = True
for i in range(1,N):
  if word[i][0] != word[i-1][-1] :
    ok = False
print('Yes' if ok else 'No')


N = int(input())
word = [input() for _ in range(N)]
s = set(word)
ok = True
if len(s) != N:
    ok = False
for i in range(1,N):
  if word[i][0] != word[i-1][-1] :
    ok = False
print('Yes' if ok else 'No')


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())
ls = []
w = []
for i in range(N):
  ls.append(str(input())
for j in range(1,N):
  if ls[j-1][(len(ls[j])-1):] and ls[j][(len(ls[j])-1):]
    if ls[j-1] in w:
      print("No")
    else:
      w.append(ls[j-1])
  else:
    print("No")
    break

N = int(input())
w = []
w1 = ""
flag = 0
for i in range(N):
  s = input()
  if i == 0:
    w1 = s
    w.append(w1)
  else:
    if s[0] == w[i-1][-1] and s not in w:
      w1 = s
      w.append(w1)
    else:
      flag += 1
      break
print("No") if flag == 1 else print("Yes")

Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n = int(input())
w = [input() for _ in range(n)]

flag=True
if len(set(w))!=n:
    flag=False
    
for i in range(n-1):
    print(flag)
    if w[i][-1]!=w[i+1][0]:
        flag=False

print("Yes" if flag else "No")


n = int(input())
w = [input() for _ in range(n)]

flag=True
if len(set(w))!=n:
    flag=False
    
for i in range(n-1):
    print(flag)
    if w[i][-1]!=w[i+1][0]:
        flag=False

print("Yes" if flag else "No")


n = int(input())
w = [input() for _ in range(n)]

flag=True
if len(set(w))!=n:
    flag=False
    
for i in range(n-1):
    if w[i][-1]!=w[i+1][0]:
        flag=False

print("Yes" if flag else "No")

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n = int(input())
flag = True
s = []
w1 = input()
e = w1[-1]
print(e)
for i in range(n-1):
    wi = input()
    if e != wi[0]:
        flag = False
    e = wi[-1]
    print(e)

if flag:
  print("Yes")
else:
  print("No")

n = int(input())
flag = True
s = []
words = []
w1 = input()
words.append(w1)
e = w1[-1]
print(e)
for i in range(n-1):
    wi = input()
    if e != wi[0]:
        flag = False
    for w in words:
        if w == wi:
            flag = False
    words.append(wi)
    e = wi[-1]
    print(e)

if flag:
  print("Yes")
else:
  print("No")

n = input()
flag = True
s = []
w1 = input()
e = w1[-1]
for i in range(n-1):
  wi = input()
  if e != wi[-1]:
    flag = False
  
  e = wi[-1]
  
if flag:
  print("Yes")
  
else:
  print("No")

n = int(input())
flag = True
s = []
words = []
w1 = input()
words.append(w1)
e = w1[-1]

for i in range(n-1):
    wi = input()
    if e != wi[0]:
        flag = False
    for w in words:
        if w == wi:
            flag = False
    words.append(wi)
    e = wi[-1]


if flag:
  print("Yes")
else:
  print("No")

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())
a = input()
for i in range(N-1):
  b = input()
  if a[-1] != b[0]:
    print("No")
  else:
    a = b

print("Yes")
    
 

N = int(input())
words = [input() for _ in range(N)]
a = words[0]
if len(set(words)) != N:
  print("No")
  exit()
for i in range(1, N):
  b = words[i]
  if a[-1] != b[0]:
    print("No")
    exit()
  else:
    a = b

print("Yes")
 

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
import copy
n = int(input())

word = [input() for _ in range(n)]
word2 = copy.deepcopy(word)
word2.append("pogyaaaaaaaaaaaaaaaaaaa")
flag = 0


for index, q in enumerate(word):
    for index2, w in enumerate(word):
        if index == index2:
            continue
        
        if q == w:
            flag += 1
        else:
            flag = 0
            
i = 0
for i in range(n-1):
    if word[i][-1] == word2[i+1][0]:
        flag = 0
    else:
        flag += 1

if flag != 0:
    print("No")
else:
    print("Yes")


import copy
n = int(input())

word = [input() for _ in range(n)]
word2 = copy.deepcopy(word)
word2.append("koredeiinokasira...tukareta")
flag = 0


for index, q in enumerate(word):
    for index2, w in enumerate(word):
        
        
        if q == w:
            if index == index2:
                continue
            flag += 1
        
            

i = 0
for i in range(n-1):
    if word[i][-1] == word2[i+1][0]:
        flag += 0
    else:
        flag += 1


if flag != 0:
    print("No")
else:
    print("Yes")


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())
a = list(input() for i in range(N))
for i in range(N):
		if a[i+1] == a[i]:
			print('No')
			break
		elif a[i+1][0:1] != a[i][-1:]:
			print('No')
			break
		elif N == 1:
			print('Yes')
			break
		else:
			print('Yes')
			break

N = int(input())
a = list(input() for i in range(N)) 
k = 0
for i in range(N-1): 
  if a.count(a[i]) != 1:
    print('No')
    break
  elif (a[i+1][0:1]) != (a[i][-1:]): 
    print('No')
    break
  else:
    k = k + 1

if k == (N-1):
  print('Yes')


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())
W = [input() for _ in range(N)]

prev = ''
if len(set(W)) != len(W):
    exit(0)

prev = W[0]
for w in W[1:]:
    if prev[-1] != w[0]:
        print(prev[-1], w[0])
        print('No')
        exit(0)
    prev = w
print('Yes')

N = int(input())
W = [input() for _ in range(N)]

prev = ''
if len(set(W)) != len(W):
    exit(0)

prev = W[0]
for w in W[1:]:
    if prev[-1] != w[0]:
        print('No')
        exit(0)
    prev = w
print('Yes')

N = int(input())
W = [input() for _ in range(N)]

if len(set(W)) != len(W):
    print('No')
    exit(0)

prev = W[0]
for w in W[1:]:
    if prev[-1] != w[0]:
        print('No')
        exit(0)
    prev = w
print('Yes')

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n=int(input())
w=[input() for i in range(n)]
last=""
wl=[]
ans="Yes"
for x,i in enumerate(w):
    if x==0:
        last=i[-1]
        continue
    if i in wl:
        ans="No"
    if i[0]!=last:
        ans="No"
    last=i[-1]
    wl.append(i)
print(ans)

n=int(input())
w=[input() for i in range(n)]
last=""
wl=[]
ans="Yes"
for x,i in enumerate(w):
    if x==0:
        last=i[-1]
        wl.append(i)
        continue
    if i in wl:
        ans="No"
    if i[0]!=last:
        ans="No"
    last=i[-1]
    wl.append(i)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
# -*- coding: utf-8 -*-
import sys
n = int(input());
words = []

for i in range(n):
    words.append(input())


                            if (len(words) > len(set(words))):
    print('No')
    sys.exit(0)

before_word = words.pop(0)
while( len(words) > 0 ):
    after_word = words.pop(0)
    
    if (before_word[-1] != after_word[0]):
        print('No')
        sys.exit(0)
    before_word = after_word
print('Yes')

# -*- coding: utf-8 -*-
import sys
n = int(input());
words = []

for i in range(n):
    words.append(input())

if (len(words) > len(set(words))):
    print('No')
    sys.exit(0)

before_word = words.pop(0)
while( len(words) > 0 ):
    after_word = words.pop(0)
    if (before_word[-1] != after_word[0]):
        print('No')
        sys.exit(0)
    before_word = after_word
print('Yes')

Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
import collections

N = int(input())
W = [input() for i in range(N)]
w = collections.Counter(W)
print(w)
if len(w.values()) != len(W):
  print('No')
else:
  for i in range(len(W)-1):
    s = W[i]
    tmp = s[len(s)-1]
    s_next = W[i+1]
    if tmp != s_next[0]:
      print('No')
      break
  else:
    print('Yes')


import collections

N = int(input())
W = [input() for i in range(N)]
w = collections.Counter(W)
if sum(w.values()) > len(W):
  print('No')
else:
  for i in range(len(W)-1):
    s = W[i]
    tmp = s[len(s)-1]
    s_next = W[i+1]
    if tmp != s_next[0]:
      print('No')
      break
  else:
    print('Yes')

import collections

N = int(input())
W = [input() for i in range(N)]
w = collections.Counter(W)
if len(w.values()) != len(W):
  print('No')
else:
  for i in range(len(W)-1):
    s = W[i]
    tmp = s[len(s)-1]
    s_next = W[i+1]
    if tmp != s_next[0]:
      print('No')
      break
  else:
    print('Yes')


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n=int(input)
flag=True
a=0
l=[]
for i in range(n):
    b=a
    l.append(b)
    a=list(input())
    if i>0:
        if a[0]!=b[-1] or a in l:
            flag=False
if flag:
    print('Yes')
else:
    print('No')

n=int(input())
flag=True
a=0
l=[]
for i in range(n):
    b=a
    l.append(b)
    a=list(input())
    if i>0:
        if a[0]!=b[-1] or a in l:
            flag=False
if flag:
    print('Yes')
else:
    print('No')

Verdicts: Runtime Error

Accepted