message
stringlengths
2
11.9k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
137
108k
cluster
float64
18
18
__index_level_0__
int64
274
217k
Provide a correct Python 3 solution for this coding contest problem. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN.
instruction
0
102,804
18
205,608
"Correct Solution: ``` print(''.join(list(map(lambda i: i.upper(),input())))) ```
output
1
102,804
18
205,609
Provide a correct Python 3 solution for this coding contest problem. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN.
instruction
0
102,805
18
205,610
"Correct Solution: ``` from functools import reduce from operator import add print(reduce(add, map(str.capitalize, input()[:]), '')) ```
output
1
102,805
18
205,611
Provide a correct Python 3 solution for this coding contest problem. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN.
instruction
0
102,806
18
205,612
"Correct Solution: ``` import math def run(): text = input().strip() print(text.upper()) if __name__ == '__main__': run() ```
output
1
102,806
18
205,613
Provide a correct Python 3 solution for this coding contest problem. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN.
instruction
0
102,807
18
205,614
"Correct Solution: ``` a=input() a=str.upper(a) print(a) ```
output
1
102,807
18
205,615
Provide a correct Python 3 solution for this coding contest problem. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN.
instruction
0
102,808
18
205,616
"Correct Solution: ``` l = str(input()) print(str.upper(l)) ```
output
1
102,808
18
205,617
Provide a correct Python 3 solution for this coding contest problem. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN.
instruction
0
102,809
18
205,618
"Correct Solution: ``` a=str(input()) b=str.upper(a) print(b) ```
output
1
102,809
18
205,619
Provide a correct Python 3 solution for this coding contest problem. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN.
instruction
0
102,810
18
205,620
"Correct Solution: ``` A=input() print(A.upper()) ```
output
1
102,810
18
205,621
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN. Submitted Solution: ``` L = list(input()) LL = [] for i in L: LL.append(i.upper()) print( "".join(LL) ) ```
instruction
0
102,811
18
205,622
Yes
output
1
102,811
18
205,623
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN. Submitted Solution: ``` import sys a = 'abcdefghijklmnopqrstuvwxyz' b = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' for s in sys.stdin: t= s[:-1].translate(str.maketrans(a,b)) print(t) ```
instruction
0
102,812
18
205,624
Yes
output
1
102,812
18
205,625
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN. Submitted Solution: ``` strings = input() print(strings.upper()) ```
instruction
0
102,813
18
205,626
Yes
output
1
102,813
18
205,627
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN. Submitted Solution: ``` s = str(input()) print(s.upper()) ```
instruction
0
102,814
18
205,628
Yes
output
1
102,814
18
205,629
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN. Submitted Solution: ``` print(' '.join(list(map(lambda i: i.upper(),input().split())))) ```
instruction
0
102,815
18
205,630
No
output
1
102,815
18
205,631
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN. Submitted Solution: ``` # coding=utf-8 sentence = input() sentence.upper() print(sentence) ```
instruction
0
102,816
18
205,632
No
output
1
102,816
18
205,633
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN. Submitted Solution: ``` def Capitalize(): for i in sys.stdin: print(i.upper()) ```
instruction
0
102,817
18
205,634
No
output
1
102,817
18
205,635
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. Output Print the converted text. Example Input this is a pen. Output THIS IS A PEN. Submitted Solution: ``` # -*- coding: utf-8 -*- def main(_text: str): print(_text.upper(), end='') while True: try: text = input() except: break main(text) ```
instruction
0
102,818
18
205,636
No
output
1
102,818
18
205,637
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Constanze is the smartest girl in her village but she has bad eyesight. One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce 'c', 'o', 'd', and 'e' in that order, then the machine will inscribe "code" onto the paper. Thanks to this machine, she can finally write messages without using her glasses. However, her dumb friend Akko decided to play a prank on her. Akko tinkered with the machine so that if you pronounce 'w', it will inscribe "uu" instead of "w", and if you pronounce 'm', it will inscribe "nn" instead of "m"! Since Constanze had bad eyesight, she was not able to realize what Akko did. The rest of the letters behave the same as before: if you pronounce any letter besides 'w' and 'm', the machine will just inscribe it onto a piece of paper. The next day, I received a letter in my mailbox. I can't understand it so I think it's either just some gibberish from Akko, or Constanze made it using her machine. But since I know what Akko did, I can just list down all possible strings that Constanze's machine would have turned into the message I got and see if anything makes sense. But I need to know how much paper I will need, and that's why I'm asking you for help. Tell me the number of strings that Constanze's machine would've turned into the message I got. But since this number can be quite large, tell me instead its remainder when divided by 10^9+7. If there are no strings that Constanze's machine would've turned into the message I got, then print 0. Input Input consists of a single line containing a string s (1 ≤ |s| ≤ 10^5) — the received message. s contains only lowercase Latin letters. Output Print a single integer — the number of strings that Constanze's machine would've turned into the message s, modulo 10^9+7. Examples Input ouuokarinn Output 4 Input banana Output 1 Input nnn Output 3 Input amanda Output 0 Note For the first example, the candidate strings are the following: "ouuokarinn", "ouuokarim", "owokarim", and "owokarinn". For the second example, there is only one: "banana". For the third example, the candidate strings are the following: "nm", "mn" and "nnn". For the last example, there are no candidate strings that the machine can turn into "amanda", since the machine won't inscribe 'm'. Submitted Solution: ``` import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools # import time,random,resource # sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 mod2 = 998244353 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def pf(s): return print(s, flush=True) def pe(s): return print(str(s), file=sys.stderr) def JA(a, sep): return sep.join(map(str, a)) def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a) def IF(c, t, f): return t if c else f def YES(c): return IF(c, "YES", "NO") def Yes(c): return IF(c, "Yes", "No") def main(): t = 1 rr = [] for _ in range(t): s = S() dp = [1,0,0] for c in s: np = [0] * 3 t = sum(dp) % mod if c == 'u': np[0] = dp[1] np[1] = t elif c == 'n': np[0] = dp[2] np[2] = t elif c in 'mw': dp = [0] break else: np[0] = t dp = np rr.append(sum(dp) % mod) return JA(rr, "\n") print(main()) ```
instruction
0
103,018
18
206,036
Yes
output
1
103,018
18
206,037
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Constanze is the smartest girl in her village but she has bad eyesight. One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce 'c', 'o', 'd', and 'e' in that order, then the machine will inscribe "code" onto the paper. Thanks to this machine, she can finally write messages without using her glasses. However, her dumb friend Akko decided to play a prank on her. Akko tinkered with the machine so that if you pronounce 'w', it will inscribe "uu" instead of "w", and if you pronounce 'm', it will inscribe "nn" instead of "m"! Since Constanze had bad eyesight, she was not able to realize what Akko did. The rest of the letters behave the same as before: if you pronounce any letter besides 'w' and 'm', the machine will just inscribe it onto a piece of paper. The next day, I received a letter in my mailbox. I can't understand it so I think it's either just some gibberish from Akko, or Constanze made it using her machine. But since I know what Akko did, I can just list down all possible strings that Constanze's machine would have turned into the message I got and see if anything makes sense. But I need to know how much paper I will need, and that's why I'm asking you for help. Tell me the number of strings that Constanze's machine would've turned into the message I got. But since this number can be quite large, tell me instead its remainder when divided by 10^9+7. If there are no strings that Constanze's machine would've turned into the message I got, then print 0. Input Input consists of a single line containing a string s (1 ≤ |s| ≤ 10^5) — the received message. s contains only lowercase Latin letters. Output Print a single integer — the number of strings that Constanze's machine would've turned into the message s, modulo 10^9+7. Examples Input ouuokarinn Output 4 Input banana Output 1 Input nnn Output 3 Input amanda Output 0 Note For the first example, the candidate strings are the following: "ouuokarinn", "ouuokarim", "owokarim", and "owokarinn". For the second example, there is only one: "banana". For the third example, the candidate strings are the following: "nm", "mn" and "nnn". For the last example, there are no candidate strings that the machine can turn into "amanda", since the machine won't inscribe 'm'. Submitted Solution: ``` MOD = 1000000007 ii = lambda: int(input()) si = lambda: input() dgl = lambda: list(map(int, input())) f = lambda: list(map(int, input().split())) il = lambda: list(map(int, input().split())) ls = lambda: list(input()) s=si() n=len(s) dp=[0]*(n+2) dp[0]=1 dp[1]=1 if not s[0] in ['m','w'] else 0 for i in range(2,n+1): if s[i-1] in ['m','w']: exit(print(0)) dp[i]=dp[i-1] if s[i-1]=='n' or s[i-1]=='u': if s[i-2]==s[i-1]: dp[i]+=dp[i-2] dp[i]%=MOD print(dp[n]) ```
instruction
0
103,019
18
206,038
Yes
output
1
103,019
18
206,039
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Constanze is the smartest girl in her village but she has bad eyesight. One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce 'c', 'o', 'd', and 'e' in that order, then the machine will inscribe "code" onto the paper. Thanks to this machine, she can finally write messages without using her glasses. However, her dumb friend Akko decided to play a prank on her. Akko tinkered with the machine so that if you pronounce 'w', it will inscribe "uu" instead of "w", and if you pronounce 'm', it will inscribe "nn" instead of "m"! Since Constanze had bad eyesight, she was not able to realize what Akko did. The rest of the letters behave the same as before: if you pronounce any letter besides 'w' and 'm', the machine will just inscribe it onto a piece of paper. The next day, I received a letter in my mailbox. I can't understand it so I think it's either just some gibberish from Akko, or Constanze made it using her machine. But since I know what Akko did, I can just list down all possible strings that Constanze's machine would have turned into the message I got and see if anything makes sense. But I need to know how much paper I will need, and that's why I'm asking you for help. Tell me the number of strings that Constanze's machine would've turned into the message I got. But since this number can be quite large, tell me instead its remainder when divided by 10^9+7. If there are no strings that Constanze's machine would've turned into the message I got, then print 0. Input Input consists of a single line containing a string s (1 ≤ |s| ≤ 10^5) — the received message. s contains only lowercase Latin letters. Output Print a single integer — the number of strings that Constanze's machine would've turned into the message s, modulo 10^9+7. Examples Input ouuokarinn Output 4 Input banana Output 1 Input nnn Output 3 Input amanda Output 0 Note For the first example, the candidate strings are the following: "ouuokarinn", "ouuokarim", "owokarim", and "owokarinn". For the second example, there is only one: "banana". For the third example, the candidate strings are the following: "nm", "mn" and "nnn". For the last example, there are no candidate strings that the machine can turn into "amanda", since the machine won't inscribe 'm'. Submitted Solution: ``` n = input() count = 1 for i in n: if i in ['w', 'm']: print(0) exit() dp = [0] * (len(n) + 1) dp[0] = 1 dp[1] = 1 for i in range(2, len(n) + 1): dp[i] = dp[i - 1] if n[i - 1] == n[i - 2] and n[i - 1] in ['u', 'n']: dp[i] = (dp[i] + dp[i - 2]) % 1000000007 print(dp[len(n)]) ```
instruction
0
103,020
18
206,040
Yes
output
1
103,020
18
206,041
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Constanze is the smartest girl in her village but she has bad eyesight. One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce 'c', 'o', 'd', and 'e' in that order, then the machine will inscribe "code" onto the paper. Thanks to this machine, she can finally write messages without using her glasses. However, her dumb friend Akko decided to play a prank on her. Akko tinkered with the machine so that if you pronounce 'w', it will inscribe "uu" instead of "w", and if you pronounce 'm', it will inscribe "nn" instead of "m"! Since Constanze had bad eyesight, she was not able to realize what Akko did. The rest of the letters behave the same as before: if you pronounce any letter besides 'w' and 'm', the machine will just inscribe it onto a piece of paper. The next day, I received a letter in my mailbox. I can't understand it so I think it's either just some gibberish from Akko, or Constanze made it using her machine. But since I know what Akko did, I can just list down all possible strings that Constanze's machine would have turned into the message I got and see if anything makes sense. But I need to know how much paper I will need, and that's why I'm asking you for help. Tell me the number of strings that Constanze's machine would've turned into the message I got. But since this number can be quite large, tell me instead its remainder when divided by 10^9+7. If there are no strings that Constanze's machine would've turned into the message I got, then print 0. Input Input consists of a single line containing a string s (1 ≤ |s| ≤ 10^5) — the received message. s contains only lowercase Latin letters. Output Print a single integer — the number of strings that Constanze's machine would've turned into the message s, modulo 10^9+7. Examples Input ouuokarinn Output 4 Input banana Output 1 Input nnn Output 3 Input amanda Output 0 Note For the first example, the candidate strings are the following: "ouuokarinn", "ouuokarim", "owokarim", and "owokarinn". For the second example, there is only one: "banana". For the third example, the candidate strings are the following: "nm", "mn" and "nnn". For the last example, there are no candidate strings that the machine can turn into "amanda", since the machine won't inscribe 'm'. Submitted Solution: ``` import math import bisect import copy from collections import defaultdict from collections import OrderedDict #for _ in range(int(input())): #n = int(input()) s = list(input()) n = len(s) #print(s) #a,b,n = map(int,input().split()) #ar = list(map(int,input().split())) #br = list(map(int,input().split())) c = [] i = 0 x = 1 while i < n : while i < n-1 and s[i] == s[i+1] == 'u': x += 1 i += 1 if i == n-1 or s[i] != s[i+1]: break if x>1: c.append(x) x = 1 while i < n-1 and s[i] == s[i+1] == 'n': x += 1 i += 1 if i == n-1 or s[i] != s[i+1]: break if x>1: c.append(x) x = 1 if x == 1: i += 1 fibo = [1,2] #print(c,fibo) ans = 0 if n == 1: if s[0] == 'w' or s[0] == 'm': ans = -1 else: for i in range(n): if i== 0: if s[i] =='w' and s[i] != s[i+1]: ans = -1 break elif s[i] == 'm' and s[i] != s[i+1]: ans = -1 break elif i == n-1: if s[i] =='w' and s[i] != s[i-1]: ans = -1 break elif s[i] == 'm' and s[i] != s[i-1]: ans = -1 break else: if s[i] == 'w' and s[i-1] != 'w' and s[i+1] != 'w': ans = -1 break elif s[i] == 'm' and s[i-1]!= 'm' and s[i-1] != 'm': ans = -1 break if ans == -1: print(0) else: if len(c) == 0: print(1) else: for i in range(2,max(c)): fibo.append((fibo[i-2] + fibo[i-1])%int(1e9 + 7)) ans = 1 for j in range(len(c)): ans *= fibo[c[j]-1] ans %= int(1e9 + 7) print(ans) """ stuff you should look for * int overflow, array bounds * special cases (n=1?) * do smth instead of nothing and stay organized * WRITE STUFF DOWN * DON'T GET STUCK ON ONE APPROACH """ ```
instruction
0
103,021
18
206,042
Yes
output
1
103,021
18
206,043
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Constanze is the smartest girl in her village but she has bad eyesight. One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce 'c', 'o', 'd', and 'e' in that order, then the machine will inscribe "code" onto the paper. Thanks to this machine, she can finally write messages without using her glasses. However, her dumb friend Akko decided to play a prank on her. Akko tinkered with the machine so that if you pronounce 'w', it will inscribe "uu" instead of "w", and if you pronounce 'm', it will inscribe "nn" instead of "m"! Since Constanze had bad eyesight, she was not able to realize what Akko did. The rest of the letters behave the same as before: if you pronounce any letter besides 'w' and 'm', the machine will just inscribe it onto a piece of paper. The next day, I received a letter in my mailbox. I can't understand it so I think it's either just some gibberish from Akko, or Constanze made it using her machine. But since I know what Akko did, I can just list down all possible strings that Constanze's machine would have turned into the message I got and see if anything makes sense. But I need to know how much paper I will need, and that's why I'm asking you for help. Tell me the number of strings that Constanze's machine would've turned into the message I got. But since this number can be quite large, tell me instead its remainder when divided by 10^9+7. If there are no strings that Constanze's machine would've turned into the message I got, then print 0. Input Input consists of a single line containing a string s (1 ≤ |s| ≤ 10^5) — the received message. s contains only lowercase Latin letters. Output Print a single integer — the number of strings that Constanze's machine would've turned into the message s, modulo 10^9+7. Examples Input ouuokarinn Output 4 Input banana Output 1 Input nnn Output 3 Input amanda Output 0 Note For the first example, the candidate strings are the following: "ouuokarinn", "ouuokarim", "owokarim", and "owokarinn". For the second example, there is only one: "banana". For the third example, the candidate strings are the following: "nm", "mn" and "nnn". For the last example, there are no candidate strings that the machine can turn into "amanda", since the machine won't inscribe 'm'. Submitted Solution: ``` mas = [0,1,2] b = 0 for i in range(3,10**5 + 1): mas.append((mas[i-1] + mas[i-2])%(10**9 + 7)) ans = 1 s = input() f = -1 for i in range(len(s)): if i > f: if i < len(s) and s[i] == 'n': lans = 0 while i < len(s) and s[i] == 'n': lans += 1 i += 1 ans *= mas[lans] ans = ans % (10**9 + 7) if i < len(s) and s[i] == 'u': lans = 0 while i < len(s) and s[i] == 'u': lans += 1 i += 1 ans *= mas[lans] ans = ans % (10**9 + 7) if i < len(s) and (s[i] == 'm' or s[i] == 'w'): b = 1 break f = i if b == 1: print(0) else: print(ans % (10**9 + 7)) ```
instruction
0
103,022
18
206,044
No
output
1
103,022
18
206,045
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Constanze is the smartest girl in her village but she has bad eyesight. One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce 'c', 'o', 'd', and 'e' in that order, then the machine will inscribe "code" onto the paper. Thanks to this machine, she can finally write messages without using her glasses. However, her dumb friend Akko decided to play a prank on her. Akko tinkered with the machine so that if you pronounce 'w', it will inscribe "uu" instead of "w", and if you pronounce 'm', it will inscribe "nn" instead of "m"! Since Constanze had bad eyesight, she was not able to realize what Akko did. The rest of the letters behave the same as before: if you pronounce any letter besides 'w' and 'm', the machine will just inscribe it onto a piece of paper. The next day, I received a letter in my mailbox. I can't understand it so I think it's either just some gibberish from Akko, or Constanze made it using her machine. But since I know what Akko did, I can just list down all possible strings that Constanze's machine would have turned into the message I got and see if anything makes sense. But I need to know how much paper I will need, and that's why I'm asking you for help. Tell me the number of strings that Constanze's machine would've turned into the message I got. But since this number can be quite large, tell me instead its remainder when divided by 10^9+7. If there are no strings that Constanze's machine would've turned into the message I got, then print 0. Input Input consists of a single line containing a string s (1 ≤ |s| ≤ 10^5) — the received message. s contains only lowercase Latin letters. Output Print a single integer — the number of strings that Constanze's machine would've turned into the message s, modulo 10^9+7. Examples Input ouuokarinn Output 4 Input banana Output 1 Input nnn Output 3 Input amanda Output 0 Note For the first example, the candidate strings are the following: "ouuokarinn", "ouuokarim", "owokarim", and "owokarinn". For the second example, there is only one: "banana". For the third example, the candidate strings are the following: "nm", "mn" and "nnn". For the last example, there are no candidate strings that the machine can turn into "amanda", since the machine won't inscribe 'm'. Submitted Solution: ``` from sys import stdin,stdout mod=10**9 + 7 s=input().rstrip() s=[ i for i in s] n=len(s) dp=[1]*(n) if 'm' in s or 'w' in s: print(0) exit() if len(s)==2: if s[0]=='u' and s[1]=='u': print(2) elif s[0]=='n' and s[0]=='n': print(2) else: print(1) exit() dp[0]=0 if len(s)>2: if s[0]==s[1] and (s[0]=='u' or s[0]=='n'): dp[0]=1 for i in range(2,len(s)): dp[i]=dp[i-1] if s[i]=='n' and s[i-1]=='n': dp[i]=max(dp[i-2]+2,dp[i]) if s[i]=='u' and s[i-1]=='u': dp[i]=max(dp[i-2]+2,dp[i]) print(dp[n-1]%mod) ```
instruction
0
103,023
18
206,046
No
output
1
103,023
18
206,047
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Constanze is the smartest girl in her village but she has bad eyesight. One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce 'c', 'o', 'd', and 'e' in that order, then the machine will inscribe "code" onto the paper. Thanks to this machine, she can finally write messages without using her glasses. However, her dumb friend Akko decided to play a prank on her. Akko tinkered with the machine so that if you pronounce 'w', it will inscribe "uu" instead of "w", and if you pronounce 'm', it will inscribe "nn" instead of "m"! Since Constanze had bad eyesight, she was not able to realize what Akko did. The rest of the letters behave the same as before: if you pronounce any letter besides 'w' and 'm', the machine will just inscribe it onto a piece of paper. The next day, I received a letter in my mailbox. I can't understand it so I think it's either just some gibberish from Akko, or Constanze made it using her machine. But since I know what Akko did, I can just list down all possible strings that Constanze's machine would have turned into the message I got and see if anything makes sense. But I need to know how much paper I will need, and that's why I'm asking you for help. Tell me the number of strings that Constanze's machine would've turned into the message I got. But since this number can be quite large, tell me instead its remainder when divided by 10^9+7. If there are no strings that Constanze's machine would've turned into the message I got, then print 0. Input Input consists of a single line containing a string s (1 ≤ |s| ≤ 10^5) — the received message. s contains only lowercase Latin letters. Output Print a single integer — the number of strings that Constanze's machine would've turned into the message s, modulo 10^9+7. Examples Input ouuokarinn Output 4 Input banana Output 1 Input nnn Output 3 Input amanda Output 0 Note For the first example, the candidate strings are the following: "ouuokarinn", "ouuokarim", "owokarim", and "owokarinn". For the second example, there is only one: "banana". For the third example, the candidate strings are the following: "nm", "mn" and "nnn". For the last example, there are no candidate strings that the machine can turn into "amanda", since the machine won't inscribe 'm'. Submitted Solution: ``` s=input() dp=[0]*(len(s)) dp[0]=1 temp=0 for i in range(1,len(s)): if(s[i]=='w' or s[i]=='m'): temp=1 break elif((s[i]=='u' and s[i-1]=='u') or (s[i]=='n' and s[i-1]=='n')): if(i!=1): dp[i]=dp[i-1]+dp[i-2] else: dp[i]=dp[i-1]+1 else: dp[i]=dp[i-1] # print(dp) if(temp==1): print(0) else: print(dp[len(s)-1]) ```
instruction
0
103,024
18
206,048
No
output
1
103,024
18
206,049
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Constanze is the smartest girl in her village but she has bad eyesight. One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce 'c', 'o', 'd', and 'e' in that order, then the machine will inscribe "code" onto the paper. Thanks to this machine, she can finally write messages without using her glasses. However, her dumb friend Akko decided to play a prank on her. Akko tinkered with the machine so that if you pronounce 'w', it will inscribe "uu" instead of "w", and if you pronounce 'm', it will inscribe "nn" instead of "m"! Since Constanze had bad eyesight, she was not able to realize what Akko did. The rest of the letters behave the same as before: if you pronounce any letter besides 'w' and 'm', the machine will just inscribe it onto a piece of paper. The next day, I received a letter in my mailbox. I can't understand it so I think it's either just some gibberish from Akko, or Constanze made it using her machine. But since I know what Akko did, I can just list down all possible strings that Constanze's machine would have turned into the message I got and see if anything makes sense. But I need to know how much paper I will need, and that's why I'm asking you for help. Tell me the number of strings that Constanze's machine would've turned into the message I got. But since this number can be quite large, tell me instead its remainder when divided by 10^9+7. If there are no strings that Constanze's machine would've turned into the message I got, then print 0. Input Input consists of a single line containing a string s (1 ≤ |s| ≤ 10^5) — the received message. s contains only lowercase Latin letters. Output Print a single integer — the number of strings that Constanze's machine would've turned into the message s, modulo 10^9+7. Examples Input ouuokarinn Output 4 Input banana Output 1 Input nnn Output 3 Input amanda Output 0 Note For the first example, the candidate strings are the following: "ouuokarinn", "ouuokarim", "owokarim", and "owokarinn". For the second example, there is only one: "banana". For the third example, the candidate strings are the following: "nm", "mn" and "nnn". For the last example, there are no candidate strings that the machine can turn into "amanda", since the machine won't inscribe 'm'. Submitted Solution: ``` S = input() N = len(S) out = 1 mod = (10**9)+7 """def f(num): if num%6 == 1: return 1 elif num%6 == 2: return 2 elif num%6 == 3: return 1 elif num%6 == 4: return (10**9)+6 elif num%6 == 5: return (10**9) +5 else: return (10**9)+6""" f = [0 for a in range(10**5)] f[1] = 1 f[2] = 2 for b in range(3, (10**5)): f[b] = ((f[b-1]%mod)+(f[b-2]%mod))%mod for i in range(N): if i < N and S[i] == "u": c = 1 i += 1 while i < N and S[i] == "u": c += 1 i += 1 out = ((out%mod)*(f[c]%mod))%mod if i == N: break if i < N and S[i] == "n": c = 1 i += 1 while i < N and S[i] == "n": c += 1 i += 1 out = ((out%mod)*(f[c]%mod))%mod if i == N: break if i < N and (S[i] == "m" or S[i] == "w"): out = 0 break print(out) ```
instruction
0
103,025
18
206,050
No
output
1
103,025
18
206,051
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This problem is different with easy version only by constraints on total answers length It is an interactive problem Venya joined a tour to the madhouse, in which orderlies play with patients the following game. Orderlies pick a string s of length n, consisting only of lowercase English letters. The player can ask two types of queries: * ? l r – ask to list all substrings of s[l..r]. Substrings will be returned in random order, and in every substring, all characters will be randomly shuffled. * ! s – guess the string picked by the orderlies. This query can be asked exactly once, after that the game will finish. If the string is guessed correctly, the player wins, otherwise he loses. The player can ask no more than 3 queries of the first type. To make it easier for the orderlies, there is an additional limitation: the total number of returned substrings in all queries of the first type must not exceed \left⌈ 0.777(n+1)^2 \right⌉ (⌈ x ⌉ is x rounded up). Venya asked you to write a program, which will guess the string by interacting with the orderlies' program and acting by the game's rules. Your program should immediately terminate after guessing the string using a query of the second type. In case your program guessed the string incorrectly, or it violated the game rules, it will receive verdict Wrong answer. Note that in every test case the string is fixed beforehand and will not change during the game, which means that the interactor is not adaptive. Input First line contains number n (1 ≤ n ≤ 100) — the length of the picked string. Interaction You start the interaction by reading the number n. To ask a query about a substring from l to r inclusively (1 ≤ l ≤ r ≤ n), you should output ? l r on a separate line. After this, all substrings of s[l..r] will be returned in random order, each substring exactly once. In every returned substring all characters will be randomly shuffled. In the case, if you ask an incorrect query, ask more than 3 queries of the first type or there will be more than \left⌈ 0.777(n+1)^2 \right⌉ substrings returned in total, you will receive verdict Wrong answer. To guess the string s, you should output ! s on a separate line. After printing each query, do not forget to flush the output. Otherwise, you will get Idleness limit exceeded. To flush the output, you can use: * fflush(stdout) or cout.flush() in C++; * System.out.flush() in Java; * flush(output) in Pascal; * stdout.flush() in Python; * see documentation for other languages. If you received - (dash) as an answer to any query, you need to terminate your program with exit code 0 (for example, by calling exit(0)). This means that there was an error in the interaction protocol. If you don't terminate with exit code 0, you can receive any unsuccessful verdict. Hack format To hack a solution, use the following format: The first line should contain one integer n (1 ≤ n ≤ 100) — the length of the string, and the following line should contain the string s. Example Input 4 a aa a cb b c c Output ? 1 2 ? 3 4 ? 4 4 ! aabc Submitted Solution: ``` from sys import stdout class String2: def __init__(self, s, b=None): if b is not None: self.b = b return self.b = [0] * 26 for i in s: self.b[ord(i) - ord('a')] += 1 def __add__(self, other): b = self.b.copy() for i in range(26): b[i] += other.b[i] return String2('', b) def __sub__(self, other): b = self.b.copy() for i in range(26): b[i] -= other.b[i] return b def __mul__(self, other): ans = String2('', self.b) for i in range(26): ans.b[i] *= other return ans def req(l, r, k=0): print('?', l, r) v = [''.join(sorted(input())) for i in range((r - l + 1) * (r - l + 2) // 2)] stdout.flush() return v def compute(v): bukvi = [[0] * (n + 2) for _ in range(26)] for el in v: cur = len(el) for e in el: bukvi[ord(e) - ord('a')][cur] += 1 return bukvi def compute2(bukvi): bukvis = [set() for i in range(n + 2)] for i in range(26): prev = bukvi[i][1] for j in range(1, n // 2 + n % 2 + 1): while bukvi[i][j] != prev: bukvis[j].add(chr(ord('a') + i)) prev += 1 return bukvis def solve(va, va2): for i in va2: va.remove(i) va.sort(key=len) s = va[0] for i in range(1, len(va)): for j in range(26): if va[i].count(chr(ord('a') + j)) != va[i - 1].count(chr(ord('a') + j)): s += chr(ord('a') + j) return s def check(v, s, s2, f): s3 = String2(v[0]) for i in range(1, len(v)): s3 = s3 + String2(v[i]) le = len(v[0]) cur = String2('', String2('', f - String2(s)) - String2(s2)) * le for i in range(le - 2): cur = cur + (String2(s[i]) * (i + 1)) + (String2(s2[-i]) * (i + 1)) cur = cur + (String2(s[le - 2]) * (le - 1)) + (String2(s[le - 1]) * le) e = cur - s3 for i in range(26): if e[i]: return chr(ord('a') + i) def main(): va = req(1, n) va2 = req(1, n // 2 + n % 2) va3 = req(2, n // 2 + n % 2) # bukvi2 = compute(va2) # bukvi3 = compute(va3) if n == 1: print('!', va[0][0]) return ma = [[] for i in range(n * 2)] for i in va: ma[len(i)].append(i) a = String2(''.join(ma[1])) s = solve(va2, va3) s2 = '' for i in range(2, n // 2 + 1): s2 = check(ma[i], s, s2, a) + s2 se = String2('', a - String2(s)) - String2(s2) for i in range(len(se)): if se[i]: s += chr(ord('a') + i) break print(s + s2) n = int(input()) main() ```
instruction
0
103,042
18
206,084
No
output
1
103,042
18
206,085
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This problem is different with easy version only by constraints on total answers length It is an interactive problem Venya joined a tour to the madhouse, in which orderlies play with patients the following game. Orderlies pick a string s of length n, consisting only of lowercase English letters. The player can ask two types of queries: * ? l r – ask to list all substrings of s[l..r]. Substrings will be returned in random order, and in every substring, all characters will be randomly shuffled. * ! s – guess the string picked by the orderlies. This query can be asked exactly once, after that the game will finish. If the string is guessed correctly, the player wins, otherwise he loses. The player can ask no more than 3 queries of the first type. To make it easier for the orderlies, there is an additional limitation: the total number of returned substrings in all queries of the first type must not exceed \left⌈ 0.777(n+1)^2 \right⌉ (⌈ x ⌉ is x rounded up). Venya asked you to write a program, which will guess the string by interacting with the orderlies' program and acting by the game's rules. Your program should immediately terminate after guessing the string using a query of the second type. In case your program guessed the string incorrectly, or it violated the game rules, it will receive verdict Wrong answer. Note that in every test case the string is fixed beforehand and will not change during the game, which means that the interactor is not adaptive. Input First line contains number n (1 ≤ n ≤ 100) — the length of the picked string. Interaction You start the interaction by reading the number n. To ask a query about a substring from l to r inclusively (1 ≤ l ≤ r ≤ n), you should output ? l r on a separate line. After this, all substrings of s[l..r] will be returned in random order, each substring exactly once. In every returned substring all characters will be randomly shuffled. In the case, if you ask an incorrect query, ask more than 3 queries of the first type or there will be more than \left⌈ 0.777(n+1)^2 \right⌉ substrings returned in total, you will receive verdict Wrong answer. To guess the string s, you should output ! s on a separate line. After printing each query, do not forget to flush the output. Otherwise, you will get Idleness limit exceeded. To flush the output, you can use: * fflush(stdout) or cout.flush() in C++; * System.out.flush() in Java; * flush(output) in Pascal; * stdout.flush() in Python; * see documentation for other languages. If you received - (dash) as an answer to any query, you need to terminate your program with exit code 0 (for example, by calling exit(0)). This means that there was an error in the interaction protocol. If you don't terminate with exit code 0, you can receive any unsuccessful verdict. Hack format To hack a solution, use the following format: The first line should contain one integer n (1 ≤ n ≤ 100) — the length of the string, and the following line should contain the string s. Example Input 4 a aa a cb b c c Output ? 1 2 ? 3 4 ? 4 4 ! aabc Submitted Solution: ``` from sys import stdout class String2: def __init__(self, s, b=None): if b is not None: self.b = b return self.b = [0] * 26 for i in s: self.b[ord(i) - ord('a')] += 1 def __add__(self, other): b = self.b.copy() for i in range(26): b[i] += other.b[i] return String2('', b) def __sub__(self, other): b = self.b.copy() for i in range(26): b[i] -= other.b[i] return b def __mul__(self, other): ans = String2('', self.b) for i in range(26): ans.b[i] *= other return ans def req(l, r, k=0): print('?', l, r) v = [''.join(sorted(input())) for i in range((r - l + 1) * (r - l + 2) // 2)] stdout.flush() return v def compute(v): bukvi = [[0] * (n + 2) for _ in range(26)] for el in v: cur = len(el) for e in el: bukvi[ord(e) - ord('a')][cur] += 1 return bukvi def compute2(bukvi): bukvis = [set() for i in range(n + 2)] for i in range(26): prev = bukvi[i][1] for j in range(1, n // 2 + n % 2 + 1): while bukvi[i][j] != prev: bukvis[j].add(chr(ord('a') + i)) prev += 1 return bukvis def solve(va, va2): for i in va2: va.remove(i) va.sort(key=len) s = va[0] for i in range(1, len(va)): for j in range(26): if va[i].count(chr(ord('a') + j)) != va[i - 1].count(chr(ord('a') + j)): s += chr(ord('a') + j) return s def check(v, s, s2, f): s3 = String2(v[0]) for i in range(1, len(v)): s3 = s3 + String2(v[i]) le = len(v[0]) cur = String2('', String2('', f - String2(s)) - String2(s2)) * le for i in range(le - 2): cur = cur + (String2(s[i]) * (i + 1)) + (String2(s2[-i]) * (i + 1)) cur = cur + (String2(s[le - 2]) * (le - 1)) + (String2(s[le - 1]) * le) e = cur - s3 for i in range(26): if e[i]: return chr(ord('a') + i) def main(): if n == 1: va = req(1, 1) print('!', va[0]) return elif n == 2: va2 = req(1, 1) va3 = req(2, 2) print('!', va2[0] + va3[0]) return elif n == 3: va = req(1, 1) va2 = req(2, 2) va3 = req(3, 3) print('!', va[0] + va2[0] + va3[0]) return va = req(1, n) va2 = req(1, max(n // 2 + n % 2, 2)) va3 = req(2, max(n // 2 + n % 2, 2)) # bukvi2 = compute(va2) # bukvi3 = compute(va3) ma = [[] for i in range(n * 2)] for i in va: ma[len(i)].append(i) a = String2(''.join(ma[1])) s = solve(va2, va3) s2 = '' for i in range(2, n // 2 + 1): s2 = check(ma[i], s, s2, a) + s2 se = String2('', a - String2(s)) - String2(s2) for i in range(len(se)): if se[i]: s += chr(ord('a') + i) break print('!', s + s2) n = int(input()) main() ```
instruction
0
103,043
18
206,086
No
output
1
103,043
18
206,087
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This problem is different with easy version only by constraints on total answers length It is an interactive problem Venya joined a tour to the madhouse, in which orderlies play with patients the following game. Orderlies pick a string s of length n, consisting only of lowercase English letters. The player can ask two types of queries: * ? l r – ask to list all substrings of s[l..r]. Substrings will be returned in random order, and in every substring, all characters will be randomly shuffled. * ! s – guess the string picked by the orderlies. This query can be asked exactly once, after that the game will finish. If the string is guessed correctly, the player wins, otherwise he loses. The player can ask no more than 3 queries of the first type. To make it easier for the orderlies, there is an additional limitation: the total number of returned substrings in all queries of the first type must not exceed \left⌈ 0.777(n+1)^2 \right⌉ (⌈ x ⌉ is x rounded up). Venya asked you to write a program, which will guess the string by interacting with the orderlies' program and acting by the game's rules. Your program should immediately terminate after guessing the string using a query of the second type. In case your program guessed the string incorrectly, or it violated the game rules, it will receive verdict Wrong answer. Note that in every test case the string is fixed beforehand and will not change during the game, which means that the interactor is not adaptive. Input First line contains number n (1 ≤ n ≤ 100) — the length of the picked string. Interaction You start the interaction by reading the number n. To ask a query about a substring from l to r inclusively (1 ≤ l ≤ r ≤ n), you should output ? l r on a separate line. After this, all substrings of s[l..r] will be returned in random order, each substring exactly once. In every returned substring all characters will be randomly shuffled. In the case, if you ask an incorrect query, ask more than 3 queries of the first type or there will be more than \left⌈ 0.777(n+1)^2 \right⌉ substrings returned in total, you will receive verdict Wrong answer. To guess the string s, you should output ! s on a separate line. After printing each query, do not forget to flush the output. Otherwise, you will get Idleness limit exceeded. To flush the output, you can use: * fflush(stdout) or cout.flush() in C++; * System.out.flush() in Java; * flush(output) in Pascal; * stdout.flush() in Python; * see documentation for other languages. If you received - (dash) as an answer to any query, you need to terminate your program with exit code 0 (for example, by calling exit(0)). This means that there was an error in the interaction protocol. If you don't terminate with exit code 0, you can receive any unsuccessful verdict. Hack format To hack a solution, use the following format: The first line should contain one integer n (1 ≤ n ≤ 100) — the length of the string, and the following line should contain the string s. Example Input 4 a aa a cb b c c Output ? 1 2 ? 3 4 ? 4 4 ! aabc Submitted Solution: ``` from sys import stdout class String2: def __init__(self, s, b=None): if b is not None: self.b = b return self.b = [0] * 26 for i in s: self.b[ord(i) - ord('a')] += 1 def __add__(self, other): b = self.b.copy() for i in range(26): b[i] += other.b[i] return String2('', b) def __sub__(self, other): b = self.b.copy() for i in range(26): b[i] -= other.b[i] return b def __mul__(self, other): ans = String2('', self.b) for i in range(26): ans.b[i] *= other return ans def req(l, r, k=0): print('?', l, r) v = [''.join(sorted(input())) for i in range((r - l + 1) * (r - l + 2) // 2)] stdout.flush() return v def compute(v): bukvi = [[0] * (n + 2) for _ in range(26)] for el in v: cur = len(el) for e in el: bukvi[ord(e) - ord('a')][cur] += 1 return bukvi def compute2(bukvi): bukvis = [set() for i in range(n + 2)] for i in range(26): prev = bukvi[i][1] for j in range(1, n // 2 + n % 2 + 1): while bukvi[i][j] != prev: bukvis[j].add(chr(ord('a') + i)) prev += 1 return bukvis def solve(va, va2): for i in va2: va.remove(i) va.sort(key=len) s = va[0] for i in range(1, len(va)): for j in range(26): if va[i].count(chr(ord('a') + j)) != va[i - 1].count(chr(ord('a') + j)): s += chr(ord('a') + j) return s def check(v, s, s2, f): s3 = String2(v[0]) for i in range(1, len(v)): s3 = s3 + String2(v[i]) le = len(v[0]) cur = String2('', String2('', f - String2(s)) - String2(s2)) * le for i in range(le - 2): cur = cur + (String2(s[i]) * (i + 1)) + (String2(s2[-i]) * (i + 1)) cur = cur + (String2(s[le - 2]) * (le - 1)) + (String2(s[le - 1]) * le) e = cur - s3 for i in range(26): if e[i]: return chr(ord('a') + i) def main(): va = req(1, n) va2 = req(1, n // 2 + n % 2) va3 = req(2, n // 2 + n % 2) # bukvi2 = compute(va2) # bukvi3 = compute(va3) if n == 1: print('!', va[0][0]) return ma = [[] for i in range(n * 2)] for i in va: ma[len(i)].append(i) a = String2(''.join(ma[1])) s = solve(va2, va3) s2 = '' for i in range(2, n // 2 + 1): s2 = check(ma[i], s, s2, a) + s2 se = String2('', a - String2(s)) - String2(s2) for i in range(len(se)): if se[i]: s += chr(ord('a') + i) break print('!', s + s2) n = int(input()) main() ```
instruction
0
103,044
18
206,088
No
output
1
103,044
18
206,089
Provide a correct Python 3 solution for this coding contest 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No
instruction
0
103,495
18
206,990
"Correct Solution: ``` n=int(input()) li=[input() for _ in range(n)] if len(set(li))!=n: print("No");exit() else: for i,j in zip(li,li[1:]): if i[-1]!=j[0]: print("No");exit() print("Yes") ```
output
1
103,495
18
206,991
Provide a correct Python 3 solution for this coding contest 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No
instruction
0
103,496
18
206,992
"Correct Solution: ``` print("No" if (lambda w:(sum([w.count(s)-1 for s in w])) or sum([1-(w[i][0] == w[i-1][-1]) for i in range(1,len(w))]))([input() for i in range(int(input()))]) else "Yes") ```
output
1
103,496
18
206,993
Provide a correct Python 3 solution for this coding contest 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No
instruction
0
103,497
18
206,994
"Correct Solution: ``` L=[input()for x in' '*int(input())];print('YNeos'[any(i[-1]!=j[0]*(L.count(i))for i,j in zip(L,L[1:]))::2]) ```
output
1
103,497
18
206,995
Provide a correct Python 3 solution for this coding contest 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No
instruction
0
103,498
18
206,996
"Correct Solution: ``` n = int(input()) w = [input() for i in range(n)] x = False if n == len(set(w)): if all(w[i-1][-1] == w[i][0] for i in range(1,n)): x = True print('Yes' if x else 'No') ```
output
1
103,498
18
206,997
Provide a correct Python 3 solution for this coding contest 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No
instruction
0
103,499
18
206,998
"Correct Solution: ``` N = int(input()) w = [input()] ans = 'Yes' for i in range(N-1): tmp = input() if (tmp in w) or (w[-1][-1] != tmp[0]): ans = 'No' break w.append(tmp) print(ans) ```
output
1
103,499
18
206,999
Provide a correct Python 3 solution for this coding contest 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No
instruction
0
103,500
18
207,000
"Correct Solution: ``` l=[input() for _ in range(int(input()))] for i,w in enumerate(l): if i: if l[i][0]==l[i-1][-1] and w not in l[:i]: continue exit(print('No')) print('Yes') ```
output
1
103,500
18
207,001
Provide a correct Python 3 solution for this coding contest 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No
instruction
0
103,501
18
207,002
"Correct Solution: ``` #b N=int(input()) W=[None]*N for i in range(N): W[i] = input() if all( W[i][0]==W[i-1][-1] for i in range(1,N) ) and len(set(W))==N: print("Yes") else: print("No") ```
output
1
103,501
18
207,003
Provide a correct Python 3 solution for this coding contest 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No
instruction
0
103,502
18
207,004
"Correct Solution: ``` N = int(input()) W = [input()] for i in range(1,N): w = input() if W[i-1][-1] != w[0] or w in W: print('No') break else: W.append(w) if len(W)==N: print('Yes') ```
output
1
103,502
18
207,005
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No Submitted Solution: ``` N=int(input()) W = [input()] flg = "Yes" for i in range(1,N): W.append(input()) if not(W[i-1][-1]==W[i][0] and W.count(W[i])==1): flg = "No" break print(flg) ```
instruction
0
103,503
18
207,006
Yes
output
1
103,503
18
207,007
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No Submitted Solution: ``` n = int(input()) W = [input()] for i in range(n-1): w = input() if w in W or W[-1][-1] != w[0]: print("No") break else: W.append(w) else: print("Yes") ```
instruction
0
103,504
18
207,008
Yes
output
1
103,504
18
207,009
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No Submitted Solution: ``` 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) ```
instruction
0
103,505
18
207,010
Yes
output
1
103,505
18
207,011
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No Submitted Solution: ``` _,*l=open(0);print('YNeos'[any(a[-2]!=b[0]*l.count(a)for a,b in zip(l,l[1:]))::2]) ```
instruction
0
103,506
18
207,012
Yes
output
1
103,506
18
207,013
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No Submitted Solution: ``` N = int(input()) W = [input() for i in range(N)] word_stock = [] for word in W: #同じワード確認 if word in word_stock: print('No') #最後の文字確認 try: if word_stock[-1][-1] != word[0]: print('No') except: pass word_stock.append(word) print('Yes') ```
instruction
0
103,507
18
207,014
No
output
1
103,507
18
207,015
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No Submitted Solution: ``` N=int(input()) words=[input() for _ in range(N)] tmp=set(words) #print(tmp) c=1 if len(words)!=len(tmp): c=0 else: for i in range(N): print(words) if i==0: continue elif words[i][0]!=words[i-1][-1]: c=0 break #print(c) if c: print("Yes") else: print("No") ```
instruction
0
103,508
18
207,016
No
output
1
103,508
18
207,017
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No Submitted Solution: ``` #! /usr/bin/python from sys import stdin n = int(input()) W = stdin.read().splitlines() if n != len(set(W)): print("No") exit() for i in range(1, n-1): if W[i][-1] != W[i][0]: print("No") exit() ```
instruction
0
103,509
18
207,018
No
output
1
103,509
18
207,019
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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. Constraints * N is an integer satisfying 2 \leq N \leq 100. * W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters. Input Input is given from Standard Input in the following format: N W_1 W_2 : W_N Output If every word announced by Takahashi satisfied the conditions, print `Yes`; otherwise, print `No`. Examples Input 4 hoge english hoge enigma Output No Input 9 basic c cpp php python nadesico ocaml lua assembly Output Yes Input 8 a aa aaa aaaa aaaaa aaaaaa aaa aaaaaaa Output No Input 3 abc arc agc Output No Submitted Solution: ``` n=int(input()) lw=[input() for i in range(n)] used=set() last=lw[0][0] for w in lw: if w in used or last !=w[0]: cond=False break used.add(w) last=w[-1] print("Yes" if cond else "No") ```
instruction
0
103,510
18
207,020
No
output
1
103,510
18
207,021
Provide a correct Python 3 solution for this coding contest problem. Rng is going to a festival. The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For example, `CODEFESTIVAL` is a festival of `CODE`. Constraints * 9 \leq |S| \leq 50 * S consists of uppercase English letters. * S ends with `FESTIVAL`. Input Input is given from Standard Input in the following format: S Output Print the answer to the question: "Rng is going to a festival of what?" Examples Input CODEFESTIVAL Output CODE Input CODEFESTIVALFESTIVAL Output CODEFESTIVAL Input YAKINIKUFESTIVAL Output YAKINIKU
instruction
0
103,527
18
207,054
"Correct Solution: ``` S = input() print(S[:S.rfind("FESTIVAL")]) ```
output
1
103,527
18
207,055
Provide a correct Python 3 solution for this coding contest problem. Rng is going to a festival. The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For example, `CODEFESTIVAL` is a festival of `CODE`. Constraints * 9 \leq |S| \leq 50 * S consists of uppercase English letters. * S ends with `FESTIVAL`. Input Input is given from Standard Input in the following format: S Output Print the answer to the question: "Rng is going to a festival of what?" Examples Input CODEFESTIVAL Output CODE Input CODEFESTIVALFESTIVAL Output CODEFESTIVAL Input YAKINIKUFESTIVAL Output YAKINIKU
instruction
0
103,528
18
207,056
"Correct Solution: ``` #CODE FESTIVAL 2017 qual B a s=input() n=len(s)-len("FESTIVAL") ans="" for i in range(n): ans+=s[i] print(ans) ```
output
1
103,528
18
207,057
Provide a correct Python 3 solution for this coding contest problem. Rng is going to a festival. The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For example, `CODEFESTIVAL` is a festival of `CODE`. Constraints * 9 \leq |S| \leq 50 * S consists of uppercase English letters. * S ends with `FESTIVAL`. Input Input is given from Standard Input in the following format: S Output Print the answer to the question: "Rng is going to a festival of what?" Examples Input CODEFESTIVAL Output CODE Input CODEFESTIVALFESTIVAL Output CODEFESTIVAL Input YAKINIKUFESTIVAL Output YAKINIKU
instruction
0
103,529
18
207,058
"Correct Solution: ``` import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) s = input() print(s[:len(s) - 8]) ```
output
1
103,529
18
207,059
Provide a correct Python 3 solution for this coding contest problem. Rng is going to a festival. The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For example, `CODEFESTIVAL` is a festival of `CODE`. Constraints * 9 \leq |S| \leq 50 * S consists of uppercase English letters. * S ends with `FESTIVAL`. Input Input is given from Standard Input in the following format: S Output Print the answer to the question: "Rng is going to a festival of what?" Examples Input CODEFESTIVAL Output CODE Input CODEFESTIVALFESTIVAL Output CODEFESTIVAL Input YAKINIKUFESTIVAL Output YAKINIKU
instruction
0
103,530
18
207,060
"Correct Solution: ``` s=str(input()) print(s[:-8]) ```
output
1
103,530
18
207,061
Provide a correct Python 3 solution for this coding contest problem. Rng is going to a festival. The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For example, `CODEFESTIVAL` is a festival of `CODE`. Constraints * 9 \leq |S| \leq 50 * S consists of uppercase English letters. * S ends with `FESTIVAL`. Input Input is given from Standard Input in the following format: S Output Print the answer to the question: "Rng is going to a festival of what?" Examples Input CODEFESTIVAL Output CODE Input CODEFESTIVALFESTIVAL Output CODEFESTIVAL Input YAKINIKUFESTIVAL Output YAKINIKU
instruction
0
103,531
18
207,062
"Correct Solution: ``` # CODE FESTIVAL 2017 予選 B: A – XXFESTIVAL s = input() print(s[:-8]) ```
output
1
103,531
18
207,063
Provide a correct Python 3 solution for this coding contest problem. Rng is going to a festival. The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For example, `CODEFESTIVAL` is a festival of `CODE`. Constraints * 9 \leq |S| \leq 50 * S consists of uppercase English letters. * S ends with `FESTIVAL`. Input Input is given from Standard Input in the following format: S Output Print the answer to the question: "Rng is going to a festival of what?" Examples Input CODEFESTIVAL Output CODE Input CODEFESTIVALFESTIVAL Output CODEFESTIVAL Input YAKINIKUFESTIVAL Output YAKINIKU
instruction
0
103,532
18
207,064
"Correct Solution: ``` S = input() if S[-8:] == "FESTIVAL": print("{}".format(S[0:-8])) ```
output
1
103,532
18
207,065
Provide a correct Python 3 solution for this coding contest problem. Rng is going to a festival. The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For example, `CODEFESTIVAL` is a festival of `CODE`. Constraints * 9 \leq |S| \leq 50 * S consists of uppercase English letters. * S ends with `FESTIVAL`. Input Input is given from Standard Input in the following format: S Output Print the answer to the question: "Rng is going to a festival of what?" Examples Input CODEFESTIVAL Output CODE Input CODEFESTIVALFESTIVAL Output CODEFESTIVAL Input YAKINIKUFESTIVAL Output YAKINIKU
instruction
0
103,533
18
207,066
"Correct Solution: ``` def main(): s = input() print(s[:-8]) if __name__ == "__main__": main() ```
output
1
103,533
18
207,067
Provide a correct Python 3 solution for this coding contest problem. Rng is going to a festival. The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For example, `CODEFESTIVAL` is a festival of `CODE`. Constraints * 9 \leq |S| \leq 50 * S consists of uppercase English letters. * S ends with `FESTIVAL`. Input Input is given from Standard Input in the following format: S Output Print the answer to the question: "Rng is going to a festival of what?" Examples Input CODEFESTIVAL Output CODE Input CODEFESTIVALFESTIVAL Output CODEFESTIVAL Input YAKINIKUFESTIVAL Output YAKINIKU
instruction
0
103,534
18
207,068
"Correct Solution: ``` a = input().strip() print(a[:-8]) ```
output
1
103,534
18
207,069