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):
dataNum=input()
wordList=[]
for word in input:
    wordList.append(word.strip())

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

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

print("Yes")

dataNum=int(input())
wordList=[]
for n in range(dataNum):
    wordList.append(input().strip())

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

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

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 i in range(n)]
w_set = set()
for i in range(n):
    w_set.add(w[i])

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

import sys
n=int(input())
w=[input() for i in range(n)]
w_set = set()
for i in range(n):
    w_set.add(w[i])

if len(w)!=len(w_set):
    print("No")
    sys.exit()

for i in range(n-1):
    if w[i][-1]!=w[i+1][0]:
        print("No")
        sys.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):
import sys
n=int(input())
sp=input()
l=set()
for _ in range(n-1):
    sn=input()
    if (sn in l) or (sp[-1]!=sn[0]):
        print('No')
        sys.exit()
    l.add(sn)
    sp=sn
print('Yes')

import sys
n=int(input())
sp=input()
l=set()
for _ in range(n-1):
    sn=input()
    if (sn in l) or (sp[-1]!=sn[0]):
        print('No')
        sys.exit()
    l.add(sn)
    sp=sn
print('Yes')

import sys
n=int(input())
sp=input()
l=set()
for _ in range(n-1):
    sn=input()
    if (sn in l) or (sp[-1]!=sn[0]):
        print('No')
        sys.exit()
    l.add(sp)
    sp=sn
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())
ans = 'Yes'
words = [input() for _ in range(n)]
said = set()
tail = words[0][0]
for w in words:
    if w in said or w[0] != tail:
        ans = 'No'
        print(w)
        break
    said.add(w)
    tail = w[-1]

print(ans)

n = int(input())
ans = 'Yes'
words = [input() for _ in range(n)]
said = set()
tail = words[0][0]
for w in words:
    if w in said or w[0] != tail:
        ans = 'No'
        break
    said.add(w)
    tail = w[-1]

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):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys


N = int(input())
prev = None
ok = Truen
for n in range(N):
    w = input()
    if prev is None:
        prev = w
    else:
        if prev[-1] != w[0]:
            ok = False
    prev = w
if ok:
    print('Yes')
else:
    print('No')
    
 


#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys


N = int(input())
prev = None
ok = True
for n in range(N):
    w = input()
    if prev is None:
        prev = w
    else:
        if prev[-1] != w[0]:
            ok = False
    prev = w
if ok:
    print('Yes')
else:
    print('No')
    
 


#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

N = int(input())
prev = None
ok = True
seen = set()
for n in range(N):
    w = input()
    if prev is None:
        prev = w
    else:
        if prev[-1] != w[0]:
            ok = False
    if w in seen:
        ok = False
    seen.add(w)
    prev = w
if ok:
    print('Yes')
else:
    print('No')
    
 


Verdicts: 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)]
flag = True 
b = W[0][-1] 
for i in range(1,N): 
  if b == W[i][0]:　
    b = W[i][-1]　
  else: 
    flag = False
    exit()
    
if int(len(W))!=len(set(W)):
  flag = False

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

N = int(input())
W = [input() for _ in range(N)]
flag = True
b = W[0][-1]
for i in range(1,N): 
  if b == W[i][0]:
    b = W[i][-1]
  else:
    flag = False
    break
    
if int(len(W))!=len(set(W)):
  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):
W = []
judge = True
a = ""
N = int(input())
for i in range(N):
    s = input()
    W.append(s)
    if i == 0:
        a = s[len(s)-1]
    else:
        if a != s[0] or s in W:
            judge = False
            break
        else:
            a = s[len(s)-1]
if judge:
    print("Yes"):
else:
    print("No")

W = []
judge = True
a = ""
N = int(input())
for i in range(N):
    s = input()
    if i == 0:
        a = s[len(s)-1]
    else:
        if a != s[0] or s in W:
            judge = False
            break
        else:
            a = s[len(s)-1]
    W.append(s)
if judge:
    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 collections
N=int(input())
siritori=collections.defaultdict(int)
prev=""
for i in range(N):
  word = imput()
  if word in siritori:
    print("No")
  elif prev[-1]==word[0]:
    print("No")
    siritori[word]+=1
print("Yes")

import collections
N=int(input())
siritori=collections.defaultdict(int)
prev=""
for i in range(N):
  word = input()
  if word in siritori:
    print("No")
  elif prev[-1]==word[0]:
    print("No")
  siritori[word]+=1
  prev=word
print("Yes")

import collections
N=int(input())
siritori=collections.defaultdict(int)
prev=""
for i in range(N):
  word = imput()
  if word in siritori:
    print("No")
  elif prev[-1]==word[0]:
    print("No")
  siritori[word]+=1
  prev=word
print("Yes")

N = int(input())
s = set()

flag = True
for i in range(N):
    S = input()
    if S in s:
        flag = False
    if i > 0 and S[0] != prev:
        flag = False
    s.add(S)
    prev = S[-1]
if flag:
    print("Yes")
else:
    print("No")


Verdicts: 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):
noOfWords= int(input())
words = []
satisfactor = True
for i in range(noOfWords):
    words.append(input())

if len(set(words)) < len(words):
    print("NO")    
    satisfactor = False 
else:
    for i in range(len(words)-1):
        if words[i][len(words[i])-1] ==  words[i+1][0]:
            continue
        else:
            satisfactor = False
            print("NO")
            break
if satisfactor :
    print("YES")            



N=int(input())
count=0
m=[]
s=input()
m.append(s)
for i in range(N-1):
    l=input()
    if l not in m and m[i][-1]==l[0]:
        count+=1
    m.append(l)
if count==N-1:
    print("YES")
else:
    print("NO")



N = int(input())
word = list(str(input()) for _ in range(N))
res = 'Yes'
if len(word) != len(set(word)):
    print('No')
    exit()
last = (word[0])[0]
for i, x in enumerate(word):
    if last != x[0]:
        print('No')
        exit()
    last = x[-1]
print('Yes'

x=int(input())
words=[]
found=0
word1=''
word2=''
for i in range(x):
    words.append(input())

for j in range(x-1):
    for k in range(j+1,x):
        if words[j]==words[k]:
            found=-1
for c in range(x-1):
    word1=words[c]
    word2=words[c+1]
    if word1[-1]!=word2[0]:
        found=-1
if found==-1:
    print("NO")
else:
    print("YES")

x=int(input())
words=[]
found=0
word_1=''
word_2=''
for i in range(x):
    words.append(input())

for j in range(x-1):
    for k in range(j+1,x):
        if words[j]==words[k]:
            found=-1
for c in range(x-1):
    word_1=words[c]
    word_2=words[c+1]
    if word_1[-1]!=word_2[0]:
        found=-1
if found==-1:
    print("NO")
else:
    print("YES")

a=int(input())
c=0
z=[]
y=[]
b=[]
for i in range(a):
    x=str(input())
    z.append(x[0])
    y.append(x[-1])
    if i==0:
        b.append(x)
    if x not in b and z[i]==y[i-1]:
        b.append(x)
        c+=1
if c==a-1:
    print("Yes")
else:
    print("No")

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

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())
l=[str(input()) for i in range(n)]
ans = 0
for i in range(n):
    if list(l[i])[-1] == list(l[i+1])[0] and l.count(l[i]) == 1:
        ans += 1
    else:
        ans += 0
print('Yes' if ans==n else'N0')

n=int(input())
l=[str(input()) for i in range(n)]
ans = 0
for i in range(n-1):
    if list(l[i])[-1] == list(l[i+1])[0] and l.count(l[i]) == 1:
        ans += 1
    else:
        ans += 0
print('Yes' if ans==n-1 else'N0')

n=int(input())
l=[str(input()) for i in range(n)]
ans = 'Yes'
for i in range(1,n):
    if l[i][0] != l[i-1][-1]:
        ans = 'No'
        break
if len(set(l)) != n:
  ans = 'No'
print(ans)


Verdicts: 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())
words = [input() for _ in range(n)]
print("Yes" if all([y[0] == x[-1] for x, y in zip(words, words[1:]) and len(set(words)) == n else "No")

n = int(input())
words = [input() for _ in range(n)]
print("Yes" if all([y[0] == x[-1] for x, y in zip(words, words[1:])) and len(set(words)) == n else "No")

n = int(input())
words = [input() for _ in range(n)]
print("Yes" if all([y[0] == x[-1] for x, y in zip(words, words[1:]]) and len(set(words)) == n else "No")

n = int(input())
words = [input() for _ in range(n)]
print("Yes" if all([y[0] == x[-1] for x, y in zip(words, words[1:])]) and len(set(words)) == n else "No")

Verdicts: 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):
import numpy as np
import sys

input = sys.stdin.readline

N = int(input())

x = []

res = True
for i in range(N):
    w = input()
    w = w[:(len(w)-1)]
    if w in x:
        res = False
    x.append(w)
    print(w,w[0],x[i-1][-1],res)
    if i > 0: 
        if w[0] != x[i-1][-1]:
            res = False
        

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


import numpy as np
import sys

input = sys.stdin.readline

N = int(input())

x = []

res = True
for i in range(N):
    w = input()
    w = w[:(len(w)-1)]
    if w in x:
        res = False
    x.append(w)
    if i > 0: 
        if w[0] != x[i-1][-1]:
            res = False
        

if res: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())
W=[]
for i in range(N):
  W.append(input())
for i in range(N-1):
  if W[i][-1] != W[i+1][0]:
    print('No')
    return
  for j in range(i+1, N):
    if W[i]==W[j]:
      print('No')
      return
print('Yes')

N=int(input())
W=[]
for i in range(N):
  W.append(input())
for i in range(N-1):
  if W[i][-1] != W[i+1][0]:
    print('No')
    exit()
  for j in range(i+1, N):
    if W[i]==W[j]:
      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())

ans = 'Yes'

w = []

for i in range(n):
	a = input()
	if a in w:
		ans = 'No'
	else:
		w.append(a)

if n == 2:
	if w[0][-1] != w[1][0]:
		ans = 'No'
elif n == 3:
	if w[0][-1] != w[1][0]:
		ans = 'No'
	if w[1][-1] != w[2][0]:
		ans = 'No'
else:
	for i in range(1,n-2):
		print(i)
		if b[-1] == w[i][0]:
			b = w[i]
		else:
			ans = 'No'
print(ans)


n = int(input())

ans = 'Yes'

w = []

for i in range(n):
	a = input()
	if a in w:
		ans = 'No'
	else:
		w.append(a)
b = w[0]
c = w[1:]
for i in c:
	if i[0] == b[-1]:
		b = i
	else:
		ans = 'No'
		break
print(ans)

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())
ws=[]
for i in range(n):
  w=input()
  if w in ws or w[0]!=ws[i-1][-1]:
    print("No")
    break
else:
  print("Yes")

n=int(input())
ws=[input()]
for i in range(1,n):
  w=input()
  if w in ws or w[0]!=ws[i-1][-1]:
    print("No")
    break
  ws.append(w)
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())
s=[]
fla=True
s.append(input())
for i in range(1,n):
    s.append(input())
    if fla :
        if s[i][0]==s[i-1][len(s[i-1])-1]:
            for j in range(i):
                if s[j]==s[i]:
                    fla=False
        else:
            fla=False
if fla:
    print("YES")
else :
    print("NO")


import sys 
from collections import Counter
f = open('pokemon', 'r')
names = []
for line in f:
    names.append(line)
max_length = 0
pokemon = ''
for i in range(len(names)):
    p = [names[i]]
    start = names[i][-2]
    shiritori = True
    count = 1
    while shiritori == True:
        shiritori = False
        for j in range(len(names)):
            if i != j and names[j][0] == start and not names[j] in p:
                count += 1
                start = names[j][-2]
                shiritori = True
                p.append(names[j])
                if count > max_length:
                    max_length = count
                    pokemon = names[i]
                break
    print (p)
print (pokemon + str(max_length))

N=int(input())
W=[]
same=[]
for i in range(N):
    W.append(input())

for i in range(len(W)):
    for x in range(i+1,len(W)):
        if W[i]==W[x]:
            same.append(W[i])
  
for i in range(len(W)-1):
    if len(same)!=0:
        print("NO")
        break
    
    if W[i][-1]==W[i+1][0]:
        print("YES")
        break
        
    else:
        print("NO")
        break


n = int(input())
l= []
x = 0
for elt in range(n):
    inp = input()
    l.append(inp)
for elt in range(len(l)):
    if l.count(l[elt]) > 1 :
        print("NO")
        x+=1
        break

    else:
        if elt < len(l)-1:
            if l[elt][-1] != l[elt+1][0]:
                print("NO")
                x += 1
                break
if x == 0:
    print("YES")





noOfWords= int(input())
words = []
satisfactor = True
for i in range(noOfWords):
    word = input()
    words.append(word)

if len(set(words)) < len(words):
    print("No")    
    satisfactor = False 
else:
    for i in range(len(words)-1):
        if words[i][len(words[i])-1] ==  words[i+1][0]:
            continue
        else:
            satisfactor = False
            print("No")
            break
if satisfactor :
    print("Yes")            



Verdicts: Wrong Answer

Runtime Error

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)]

if [W[i][-1] for i in range(N-1)] == [W[i+1][0] for i in range(N-1)] and len(list(set(W))) = len(W):
    print ("Yes")
else:
    print ("No")

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

if [W[i][-1] for i in range(N-1)] == [W[i+1][0] for i in range(N-1)] and len(list(set(W))) == len(W):
    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())
w=[input() for i in range(n)]
count=0
if len(w)==len(set(w)):
    for i in range(n-1):
        if w[i][-1]==w[i+1][0]:
            count+=1
else:
    print('No')
print('Yes' if count>0 else 'No')

n=int(input())
w=[input() for i in range(n)]
count=0
if len(w)==len(set(w)):
    for i in range(n-1):
        if w[i][-1]==w[i+1][0]:
            count+=1
        else:
            count=count*0
            break
else:
    count=count*0
    
print('Yes' if count>0 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())
W=[]
ss=True
for i in range (N):
  W.append(input())


for t in range (N):
    if W[t-1][-1]==W[t][0]:
      ss=True
    else:
      ss=False 
if len(W)!=N:   
  ss=False
     
if ss==False:
  print("No")
else:
  print("Yes")


N=int(input())
H=input()
word=[]
for i in range(N-1):
  S=input()
  if S in word:
    print('No')
    exit()
  else:
    if H[-1]==S[0]:
      H=S
      word.append(H)
    else:
      print('No')
      exit()
print('Yes')

N=int(input())
H=input()
word=[]
word.append(H)
for i in range(N-1):
  S=input()
  if S in word:
    print('No')
    exit()
  else:
    if H[-1]==S[0]:
      H=S
      word.append(H)
    else:
      print('No')
      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):
N = int(input().split())
a = []
flag = 1
for i in range(N):
    a.append(str(input().split()))
    if i != 0:
        for j in range(i):
            if a[i] == a[j]:
                flag =0


back = a[0][-1]
for i in range(1,N):
    front = a[i][0]
    if front != back:
        flag = 0
        break
    back = a[i][-1]

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

N = int(input())
a = []
flag = 1
for i in range(N):
    a.append(str(input()))
    if i != 0:
        for j in range(i):
            if a[i] == a[j]:
                flag =0


back = a[0][-1]
for i in range(1,N):
    front = a[i][0]
    if front != back:
        flag = 0
        break
    back = a[i][-1]

if flag == 0:
    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):
n=int(input())
B=[]
S = 0
for i in range(0,n):
    B.append((input()))
for m in range(n-1):
    if B[m][-1] == B[m+1][0]:
        S += 1
if S == n-1:
    print("Yes")
else:
    print("No")

n=int(input())
B=[]
S = 0
for i in range(0,n):
    B.append((input()))
C = set(B)
if len(B) != len(C):
    print("No")
else:
    for m in range(n-1):
        if B[m][-1] == B[m+1][0]:
            S += 1
    if S == n-1:
        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):
def main():
    n = input()
    before = ''
    words = set()

    for i in range(n):
        w = input()
        if w not in words:
            words.add(w)
        else:
            print('No')
            return

        if before == '':
            before = w
            continue

        if before[-1] != w[0]:
            print('No')
            return

    print('Yes')


main()


def main():
    n = int(input())
    before = ''
    words = set()

    for i in range(n):
        w = input()
        if w not in words:
            words.add(w)
        else:
            print('No')
            return

        if before == '':
            before = w
            continue

        if before[-1] != w[0]:
            print('No')
            return
        before = w

    print('Yes')


main()


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())
counter = 0
qq = 0
L = []
for i in range(N) :
    if i == 0 :
        w = input()
        L.append(w)
        q = w[-1]
    if i != 0 :
        w = input()
        if w in L :
            qq += 1
        p = w[0]
        if p == q :
            q = w[-1]
            counter += 1

            
            
if counter == N-1 and qq != 0 :
    print("Yes")
else :
    print("No")



N = int(input())
counter = 0
qq = 0
L = []
for i in range(N) :
    if i == 0 :
        w = input()
        L.append(w)
        q = w[-1]
    if i != 0 :
        w = input()
        if w in L :
            qq += 1
        L.append(w)
        p = w[0]
        if p == q :
            q = w[-1]
            counter += 1

            
            
if counter == N-1 and qq == 0 :
    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):
#data input
n = int(input())
i = 0
str = [0] * n 
while i <  n: 
    str[i] = input()
    i += 1
    


i = 0
count = 0
x = ""
while i < n-1:
    if str[i][-1] == str[i+1][0]:
        i += 1
    else:
        print("no")
        count = 1
        break
i = 0
while i < n:
    x =  str.count(str[i])
    if x >= 2:
        print("no")
        count = 1
        break
    i += 1



if count == 0:
    print("yes")


#data input
n = int(input())
i = 0
str = [0] * n 
while i <  n: 
    str[i] = input()
    i += 1
    


i = 0
count = 0
x = ""
while i < n-1:
    if str[i][-1] == str[i+1][0]:
        i += 1
    else:
        print("No")
        count = 1
        break
i = 0
while i < n:
    x =  str.count(str[i])
    if x >= 2:
        print("No")
        count = 1
        break
    i += 1



if count == 0:
    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,w,temp = int(input()),[],[]
for i in range(n):
    w.append(input())
    print(w[-1])
    if w[-1] in temp:
        print("No")
        exit()
    else:
        temp.append(w[-1])
    if i > 1 and w[i-1][0] != w[i][-1]:
        print("No")
        exit()
print("Yes")

n,w,temp = int(input()),[],[]
for i in range(n):
    w.append(input())
    if w[-1] in temp:
        print("No")
        exit()
    else:
        temp.append(w[-1])
    if i>0 and w[i-1][-1] != w[i][0]:
        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):
n = int(input())
w = [input() for _ in range(n)]
res = True
for i in range(1,n):
    print(w[i-1][-1])
    print(w[i][0])
    print(w[i][0] == w[i-1][-1])
    if w[i][0] != w[i-1][-1]:
        res = False
    else:
        continue
if res == True and len(w) == len(set(w)):
    print("Yes")
else:
    print("No")

n = int(input())
w = [input() for _ in range(n)]
res = True
for i in range(1,n):
    if w[i][0] != w[i-1][-1]:
        res = False
    else:
        continue
if res == True and len(w) == len(set(w)):
    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):
w = input().split('\n')
valid = False
for i in range(1,len(w))
  if w[i][-1] == w[i+1][0] and len(set(w)) == len(w) 
      vaild = True
  else: 
      vaild = False

print("Yes" if vaild else "NO")


# coding: utf-8
def is_unique(seq):
    return len(seq) == len(set(seq))
 
 
def main():
    n = int(input())
 
    w = []
    for i in range(n):
        w.append(input())
 
    for i in range(n-1):
        if w[i][-1] != w[i + 1][0] and not is_unique(w)::
            return 'No'
        else:
            return 'Yes'
 
if __name__ == '__main__':
    main()

w = input().split('\n')
valid = False
for i in range(1,len(w)):
  if w[i][-1] == w[i+1][0] and len(set(w)) == len(w):
    valid = True
  else:
    valid = False
   
  
  print("Yes" if valid else "No")

# coding: utf-8


def is_unique(seq):
    return len(seq) == len(set(seq))


def main():
    n = int(input())
    shiri = True

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

    for i in range(n-1):
        if w[i][-1] != w[i + 1][0]:
            shiri = False
            break

    if not is_unique(w):
        shiri = False

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


if __name__ == '__main__':
    print(main())


# coding: utf-8
def is_unique(seq):
    return len(seq) == len(set(seq))
 
 
def main():
    n = int(input())
 
    w = []
    for i in range(n):
        w.append(input())
 
    for i in range(n-1):
        if w[i][-1] != w[i + 1][0] or not is_unique(w):
            return 'No'
        else:
            return 'Yes'
 
if __name__ == '__main__':
    main()


w = input().split('\n')
valid = False
for i in range(1,len(w)):
  if w[i][-1] == w[i+1][0] and len(set(w)) == len(w):
    valid = True
    return
  else:
    valid = False
   
  
  print("Yes" if valid else "No")

def is_unique(seq):
    return len(seq) == len(set(seq))


def main():
    n = int(input())
    valid = False
    w = []
    for i in range(n):
        w.append(input())

    for i in range(n-1):
        if w[i][-1] != w[i + 1][0] or not is_unique(w):
            valid = False
            break
        else:
            valid = True

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


if __name__ == '__main__':
    main()

Verdicts: Runtime Error

Runtime Error

Wrong Answer

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):
# abc109_b

from collections import Counter


def solve(words):
    commons = Counter(words).most_common()
    if commons[0][1] > 1:
        return "No"
    else:
        # initial letter first word not important
        first_letters = list(map(lambda x: x[0], words[1:]))
        # final letter final word not important
        last_letters = list(map(lambda x: x[-1], words[:-1]))
        if first_letters == last_letters:
            return "Yes"
        else:
            return "No"


if __name__ == "__main__":
    N = input("")
    words = input("").split(" ")
    print(solve(words))


# abc109_b

from collections import Counter


def solve(words):
    if Counter(words).most_common()[0][1] > 1:  # repetition is present
        return "No"
    else:
        # initial letter first word not important
        # final letter final word not important
        if list(map(lambda x: x[0], words[1:])) == list(map(lambda x: x[-1], words[:-1])):
            return "Yes"
        else:
            return "No"


def solve2(words):
    for i in range(len(words) - 1):
        if words[i] in words[i + 1:]:
            return "No"
        else:
            if words[i][-1] != words[i + 1][0]:
                return "No"
    return "Yes"


if __name__ == "__main__":
    N = int(input(""))
    words = [input("") for i in range(N)]
    print(solve2(words))


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())

lst_W = []
for i in range(N):
    lst_W.extend(input().split())

ans = "Yes"

for i in range(N - 1):
    if (lst_W[i])[-1:] != (lst_W[i+1])[:1]:
        ans = "No"
        break

if len(lst_W) != len(set(lst_W)):
    

print(ans)


N = int(input())

lst_W = []
for i in range(N):
    lst_W.extend(input().split())

ans = "Yes"

for i in range(N - 1):
    if (lst_W[i])[-1:] != (lst_W[i+1])[:1]:
        ans = "No"
        break

if len(lst_W) != len(set(lst_W)):
    ans = "No"

print(ans)

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):
def shiritori():
    n = int(input())
    words = [input() for _ in range(n)]
    print(words)
    for word in words:
        count = 0
        for w in words:
            if w == word:
                count += 1
        if count > 1:
            print('No')
            exit()
    
    for i in range(n):
        if i + 1 <= n - 1:
            x = words[i+1][0]
            y = words[i][-1]
            if x == y:
                continue
            else:
                print('No')
                exit()
    
    print('Yes')


if __name__ == '__main__':
    shiritori()


def shiritori():
    n = int(input())
    words = [input() for _ in range(n)]

    for word in words:
        count = 0
        for w in words:
            if w == word:
                count += 1
        if count > 1:
            print('No')
            exit()
    
    for i in range(n):
        if i + 1 <= n - 1:
            x = words[i+1][0]
            y = words[i][-1]
            if x == y:
                continue
            else:
                print('No')
                exit()
    
    print('Yes')


if __name__ == '__main__':
    shiritori()


Verdicts: Wrong Answer

Accepted