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.
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand.
In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers.
<image>
Figure 1
When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager.
Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted.
<image>
Figure 2
Input
Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50.
Output
For each message, output the converted message or NA on one line.
Example
Input
341143514535
314
143565553551655311343411652235654535651124615163
551544654451431564
4
3411
6363636363
153414
Output
naruto
NA
do you wanna go to aizu?
yes sure!
NA
na
?????
end | instruction | 0 | 78,177 | 18 | 156,354 |
"Correct Solution:
```
def get_input():
while True:
try:
yield ''.join(input())
except EOFError:
break
table = \
["afkpuz",\
"bglqv.",\
"chmrw?",\
"dinsx!",\
"ejoty "]
N = list(get_input())
for l in range(len(N)):
str = N[l]
ans = ""
if len(str) % 2 == 1:
ans = "NA"
else:
for i in range(0,len(str),2):
x = str[i]
y = str[i+1]
if "1" <= x and x <= "6" and "1" <= y and y <= "5":
ans = ans + table[int(y)-1][int(x)-1]
else:
ans = "NA"
break
print(ans)
``` | output | 1 | 78,177 | 18 | 156,355 |
Provide a correct Python 3 solution for this coding contest problem.
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand.
In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers.
<image>
Figure 1
When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager.
Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted.
<image>
Figure 2
Input
Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50.
Output
For each message, output the converted message or NA on one line.
Example
Input
341143514535
314
143565553551655311343411652235654535651124615163
551544654451431564
4
3411
6363636363
153414
Output
naruto
NA
do you wanna go to aizu?
yes sure!
NA
na
?????
end | instruction | 0 | 78,178 | 18 | 156,356 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0127
"""
import sys
input = sys.stdin.readline
def decode(code):
result = ''
while code:
try:
c = code[:2]
result += Code_table[c]
code = code[2:]
except:
return 'NA'
return result
Code_table = {
'11': 'a', '21': 'f', '31': 'k', '41': 'p', '51': 'u', '61': 'z',
'12': 'b', '22': 'g', '32': 'l', '42': 'q', '52': 'v', '62': '.',
'13': 'c', '23': 'h', '33': 'm', '43': 'r', '53': 'w', '63': '?',
'14': 'd', '24': 'i', '34': 'n', '44': 's', '54': 'x', '64': '!',
'15': 'e', '25': 'j', '35': 'o', '45': 't', '55': 'y', '65': ' ',
}
def main(args):
for line in sys.stdin:
result = decode(line.strip())
print(result)
if __name__ == '__main__':
main(sys.argv[1:])
``` | output | 1 | 78,178 | 18 | 156,357 |
Provide a correct Python 3 solution for this coding contest problem.
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand.
In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers.
<image>
Figure 1
When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager.
Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted.
<image>
Figure 2
Input
Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50.
Output
For each message, output the converted message or NA on one line.
Example
Input
341143514535
314
143565553551655311343411652235654535651124615163
551544654451431564
4
3411
6363636363
153414
Output
naruto
NA
do you wanna go to aizu?
yes sure!
NA
na
?????
end | instruction | 0 | 78,179 | 18 | 156,358 |
"Correct Solution:
```
mes = {11:"a",12:"b",13:"c",14:"d",15:"e"
,21:"f",22:"g",23:"h",24:"i",25:"j"
,31:"k",32:"l",33:"m",34:"n",35:"o"
,41:"p",42:"q",43:"r",44:"s",45:"t"
,51:"u",52:"v",53:"w",54:"x",55:"y"
,61:"z",62:".",63:"?",64:"!",65:" "}
while True:
try:
s = input()
except:
break
ss = ""
for i in range(0, len(s), 2):
if len(s) % 2 == 1:
ss = "NA"
break
if int(s[i:i+2]) in mes:
ss+=mes[int(s[i:i+2])]
else:
ss = "NA"
break
print(ss)
``` | output | 1 | 78,179 | 18 | 156,359 |
Provide a correct Python 3 solution for this coding contest problem.
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand.
In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers.
<image>
Figure 1
When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager.
Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted.
<image>
Figure 2
Input
Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50.
Output
For each message, output the converted message or NA on one line.
Example
Input
341143514535
314
143565553551655311343411652235654535651124615163
551544654451431564
4
3411
6363636363
153414
Output
naruto
NA
do you wanna go to aizu?
yes sure!
NA
na
?????
end | instruction | 0 | 78,180 | 18 | 156,360 |
"Correct Solution:
```
L = []
L.append(list("abcde"))
L.append(list("fghij"))
L.append(list("klmno"))
L.append(list("pqrst"))
L.append(list("uvwxy"))
L.append(list("z.?! "))
while True:
try:
tmp = input()
l = [int(x)-1 for x in list(tmp)]
except:
break
if len(l) % 2 > 0:
print("NA")
continue
ferr = 0
M = []
for i, j in zip(l[0::2],l[1::2]):
if i not in range(len(L)) or j not in range(len(L[0])):
ferr += 1
else:
M.append(L[i][j])
if ferr > 0:
print("NA")
else:
print("".join(M))
``` | output | 1 | 78,180 | 18 | 156,361 |
Provide a correct Python 3 solution for this coding contest problem.
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand.
In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers.
<image>
Figure 1
When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager.
Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted.
<image>
Figure 2
Input
Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50.
Output
For each message, output the converted message or NA on one line.
Example
Input
341143514535
314
143565553551655311343411652235654535651124615163
551544654451431564
4
3411
6363636363
153414
Output
naruto
NA
do you wanna go to aizu?
yes sure!
NA
na
?????
end | instruction | 0 | 78,181 | 18 | 156,362 |
"Correct Solution:
```
dic = {}
base = ord("a")
for x in range(5):
for y in range(5):
dic[(x + 1, y + 1)] = chr(base + x * 5 + y)
dic[(6, 1)] = "z"
dic[(6, 2)] = "."
dic[(6, 3)] = "?"
dic[(6, 4)] = "!"
dic[(6, 5)] = " "
def to_mess(nums):
if len(nums) % 2 == 1:
return "NA"
mess = ""
for i in range(0, len(nums), 2):
x, y = map(int, nums[i: i + 2])
if (x, y) in dic:
mess += dic[(x, y)]
else:
return "NA"
return mess
while True:
try:
nums = input()
print(to_mess(nums))
except EOFError:
break
``` | output | 1 | 78,181 | 18 | 156,363 |
Provide a correct Python 3 solution for this coding contest problem.
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand.
In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers.
<image>
Figure 1
When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager.
Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted.
<image>
Figure 2
Input
Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50.
Output
For each message, output the converted message or NA on one line.
Example
Input
341143514535
314
143565553551655311343411652235654535651124615163
551544654451431564
4
3411
6363636363
153414
Output
naruto
NA
do you wanna go to aizu?
yes sure!
NA
na
?????
end | instruction | 0 | 78,182 | 18 | 156,364 |
"Correct Solution:
```
import sys
convert = {"1": {"1": "a", "2": "b", "3": "c", "4": "d", "5": "e"},
"2": {"1": "f", "2": "g", "3": "h", "4": "i", "5": "j"},
"3": {"1": "k", "2": "l", "3": "m", "4": "n", "5": "o"},
"4": {"1": "p", "2": "q", "3": "r", "4": "s", "5": "t"},
"5": {"1": "u", "2": "v", "3": "w", "4": "x", "5": "y"},
"6": {"1": "z", "2": ".", "3": "?", "4": "!", "5": " "},
}
for line in sys.stdin:
line = line[:-1]
if len(line) % 2 != 0:
print("NA")
continue
message = ""
line = iter(line)
for first, second in zip(*[line, line]):
if "1" <= first <= "6" and "1" <= second <= "5":
message += convert.get(first).get(second)
else:
print("NA")
break
else:
print(message)
``` | output | 1 | 78,182 | 18 | 156,365 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand.
In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers.
<image>
Figure 1
When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager.
Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted.
<image>
Figure 2
Input
Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50.
Output
For each message, output the converted message or NA on one line.
Example
Input
341143514535
314
143565553551655311343411652235654535651124615163
551544654451431564
4
3411
6363636363
153414
Output
naruto
NA
do you wanna go to aizu?
yes sure!
NA
na
?????
end
Submitted Solution:
```
table = {11:'a',12:'b',13:'c',14:'d',15:'e',
21:'f',22:'g',23:'h',24:'i',25:'j',
31:'k',32:'l',33:'m',34:'n',35:'o',
41:'p',42:'q',43:'r',44:'s',45:'t',
51:'u',52:'v',53:'w',54:'x',55:'y',
61:'z',62:'.',63:'?',64:'!',65:' '}
while True:
try:
mes = input()
ans = [table.get(int(mes[i:i+2]), 'NA') for i in range(0, len(mes), 2)]
if 'NA' in ans:
print('NA')
else:
print(''.join(ans))
except: break
``` | instruction | 0 | 78,183 | 18 | 156,366 |
Yes | output | 1 | 78,183 | 18 | 156,367 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand.
In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers.
<image>
Figure 1
When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager.
Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted.
<image>
Figure 2
Input
Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50.
Output
For each message, output the converted message or NA on one line.
Example
Input
341143514535
314
143565553551655311343411652235654535651124615163
551544654451431564
4
3411
6363636363
153414
Output
naruto
NA
do you wanna go to aizu?
yes sure!
NA
na
?????
end
Submitted Solution:
```
t = [["a","f","k","p","u","z"],["b","g","l","q","v","."],["c","h","m","r","w","?"],["d","i","n","s","x","!"],["e","j","o","t","y"," "]]
while 1:
try:
s = input()
ans = ""
i = 0
l = len(s)
if l % 2 == 0:
while i < l:
i1 = int(s[i + 1]) - 1
i2 = int(s[i]) - 1
if (i1 >= 0 and i1 <= 4) and (i2 >= 0 and i2 <= 5):
ans += t[i1][i2]
else:
break
i += 2
if len(ans) * 2 != l:
ans = "NA"
print(ans)
except:
break
``` | instruction | 0 | 78,184 | 18 | 156,368 |
Yes | output | 1 | 78,184 | 18 | 156,369 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand.
In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers.
<image>
Figure 1
When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager.
Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted.
<image>
Figure 2
Input
Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50.
Output
For each message, output the converted message or NA on one line.
Example
Input
341143514535
314
143565553551655311343411652235654535651124615163
551544654451431564
4
3411
6363636363
153414
Output
naruto
NA
do you wanna go to aizu?
yes sure!
NA
na
?????
end
Submitted Solution:
```
mes = {11:"a",12:"b",13:"c",14:"d",15: "e",21:"f",22:"g",23:"h",24:"i",25:"j"
,31:"k",32:"l",33:"m",34:"n",35:"o",41:"p",42:"q",43:"r",44:"s",45:"t"
,51:"u",52:"v",53:"w",54:"x",55:"y",61:"z",62:".",63:"?",64:"!",65:" "}
while True:
try:N=input()
except:break
if len(N) % 2 == 1:print("NA");continue
word=""
for i in range(0,len(N),2):
if int(N[i:i + 2]) in mes:word +=mes[int(N[i:i + 2])]
else:word="NA";break
print(word)
``` | instruction | 0 | 78,185 | 18 | 156,370 |
Yes | output | 1 | 78,185 | 18 | 156,371 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand.
In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers.
<image>
Figure 1
When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager.
Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted.
<image>
Figure 2
Input
Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50.
Output
For each message, output the converted message or NA on one line.
Example
Input
341143514535
314
143565553551655311343411652235654535651124615163
551544654451431564
4
3411
6363636363
153414
Output
naruto
NA
do you wanna go to aizu?
yes sure!
NA
na
?????
end
Submitted Solution:
```
# Aizu Problem 00127: Pocket Pager Input
#
import sys, math, os, copy
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
code = {1: "afkpuz", 2: "bglqv.", 3: "chmrw?", 4: "dinsx!", 5: "ejoty "}
def pocket_pager(string):
if len(string) % 2 == 1:
return "NA"
res = ""
for k in range(len(string) // 2):
i = int(string[2*k])
j = int(string[2*k+1])
if not 1 <= i <= 6 or not 1 <= j <= 5:
return "NA"
res += code[j][i-1]
return res
for line in sys.stdin:
print(pocket_pager(line.strip()))
``` | instruction | 0 | 78,186 | 18 | 156,372 |
Yes | output | 1 | 78,186 | 18 | 156,373 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand.
In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers.
<image>
Figure 1
When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager.
Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted.
<image>
Figure 2
Input
Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50.
Output
For each message, output the converted message or NA on one line.
Example
Input
341143514535
314
143565553551655311343411652235654535651124615163
551544654451431564
4
3411
6363636363
153414
Output
naruto
NA
do you wanna go to aizu?
yes sure!
NA
na
?????
end
Submitted Solution:
```
# Aizu Problem 00127: Pocket Pager Input
#
import sys, math, os, copy
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
code = {1: "afkpuz", 2: "ablqv.", 3: "chmrw?", 4: "dinsx!", 5: "ejoty "}
def pocket_pager(string):
if len(string) % 2 == 1:
return "NA"
res = ""
for k in range(len(string) // 2):
i = int(string[2*k])
j = int(string[2*k+1])
if not 1 <= i <= 6 or not 1 <= j <= 5:
return "NA"
res += code[j][i-1]
return res
for line in sys.stdin:
print(pocket_pager(line.strip()))
``` | instruction | 0 | 78,187 | 18 | 156,374 |
No | output | 1 | 78,187 | 18 | 156,375 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand.
In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers.
<image>
Figure 1
When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager.
Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted.
<image>
Figure 2
Input
Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50.
Output
For each message, output the converted message or NA on one line.
Example
Input
341143514535
314
143565553551655311343411652235654535651124615163
551544654451431564
4
3411
6363636363
153414
Output
naruto
NA
do you wanna go to aizu?
yes sure!
NA
na
?????
end
Submitted Solution:
```
import sys
convert = {"1": {"1": "a", "2": "b", "3": "c", "4": "d", "5": "e"},
"2": {"1": "f", "2": "g", "3": "h", "4": "i", "5": "j"},
"3": {"1": "k", "2": "l", "3": "m", "4": "n", "5": "o"},
"4": {"1": "p", "2": "q", "3": "r", "4": "s", "5": "t"},
"5": {"1": "u", "2": "v", "3": "w", "4": "x", "5": "y"},
"6": {"1": "z", "2": ".", "3": "?", "4": "!", "5": " "},
}
for line in sys.stdin:
line = line[:-1]
if len(line) % 2 != 0:
print("NA")
continue
message = ""
line = iter(line)
for first, second in zip(*[line, line]):
result = convert[first][second]
if result != None:
message += result
else:
print("NA")
break
else:
print(message)
``` | instruction | 0 | 78,188 | 18 | 156,376 |
No | output | 1 | 78,188 | 18 | 156,377 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand.
In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers.
<image>
Figure 1
When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager.
Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted.
<image>
Figure 2
Input
Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50.
Output
For each message, output the converted message or NA on one line.
Example
Input
341143514535
314
143565553551655311343411652235654535651124615163
551544654451431564
4
3411
6363636363
153414
Output
naruto
NA
do you wanna go to aizu?
yes sure!
NA
na
?????
end
Submitted Solution:
```
dic = {}
base = ord("a")
for x in range(5):
for y in range(5):
dic[(x + 1, y + 1)] = chr(base + x * 5 + y)
dic[(6, 1)] = "z"
dic[(6, 2)] = "."
dic[(6, 3)] = "?"
dic[(6, 4)] = "!"
dic[(6, 5)] = " "
def to_mess(nums):
if len(nums) % 2 == 1:
return "NA"
mess = ""
for i in range(0, len(nums), 2):
x, y = map(int, nums[i: i + 2])
if (x, y) in dic:
mess += dic[(x, y)]
return mess
while True:
try:
nums = input()
print(to_mess(nums))
except EOFError:
break
``` | instruction | 0 | 78,189 | 18 | 156,378 |
No | output | 1 | 78,189 | 18 | 156,379 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand.
In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers.
<image>
Figure 1
When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager.
Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted.
<image>
Figure 2
Input
Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50.
Output
For each message, output the converted message or NA on one line.
Example
Input
341143514535
314
143565553551655311343411652235654535651124615163
551544654451431564
4
3411
6363636363
153414
Output
naruto
NA
do you wanna go to aizu?
yes sure!
NA
na
?????
end
Submitted Solution:
```
import sys
convert = {"1": {"1": "a", "2": "b", "3": "c", "4": "d", "5": "e"},
"2": {"1": "f", "2": "g", "3": "h", "4": "i", "5": "j"},
"3": {"1": "k", "2": "l", "3": "m", "4": "n", "5": "o"},
"4": {"1": "p", "2": "q", "3": "r", "4": "s", "5": "t"},
"5": {"1": "u", "2": "v", "3": "w", "4": "x", "5": "y"},
"6": {"1": "z", "2": ".", "3": "?", "4": "!", "5": " "},
}
for line in sys.stdin:
line = line[:-1]
if len(line) % 2 != 0:
print("NA")
continue
message = ""
line = iter(line)
for first, second in zip(*[line, line]):
result = convert.get(first).get(second)
if result != None:
message += result
else:
print("NA")
break
else:
print(message)
``` | instruction | 0 | 78,190 | 18 | 156,380 |
No | output | 1 | 78,190 | 18 | 156,381 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line consists of two words separated by whitespace.
A lyric is beautiful if and only if it satisfies all conditions below.
* The number of vowels in the first word of the first line is the same as the number of vowels in the first word of the second line.
* The number of vowels in the second word of the first line is the same as the number of vowels in the second word of the second line.
* The last vowel of the first line is the same as the last vowel of the second line. Note that there may be consonants after the vowel.
Also, letters "a", "e", "o", "i", and "u" are vowels. Note that "y" is never vowel.
For example of a beautiful lyric,
"hello hellooowww"
"whatsup yowowowow"
is a beautiful lyric because there are two vowels each in "hello" and "whatsup", four vowels each in "hellooowww" and "yowowowow" (keep in mind that "y" is not a vowel), and the last vowel of each line is "o".
For example of a not beautiful lyric,
"hey man"
"iam mcdic"
is not a beautiful lyric because "hey" and "iam" don't have same number of vowels and the last vowels of two lines are different ("a" in the first and "i" in the second).
How many beautiful lyrics can you write from given words? Note that you cannot use a word more times than it is given to you. For example, if a word is given three times, you can use it at most three times.
Input
The first line contains single integer n (1 ≤ n ≤ 10^{5}) — the number of words.
The i-th of the next n lines contains string s_{i} consisting lowercase alphabet letters — the i-th word. It is guaranteed that the sum of the total word length is equal or less than 10^{6}. Each word contains at least one vowel.
Output
In the first line, print m — the number of maximum possible beautiful lyrics.
In next 2m lines, print m beautiful lyrics (two lines per lyric).
If there are multiple answers, print any.
Examples
Input
14
wow
this
is
the
first
mcdics
codeforces
round
hooray
i
am
proud
about
that
Output
3
about proud
hooray round
wow first
this is
i that
mcdics am
Input
7
arsijo
suggested
the
idea
for
this
problem
Output
0
Input
4
same
same
same
differ
Output
1
same differ
same same
Note
In the first example, those beautiful lyrics are one of the possible answers. Let's look at the first lyric on the sample output of the first example. "about proud hooray round" forms a beautiful lyric because "about" and "hooray" have same number of vowels, "proud" and "round" have same number of vowels, and both lines have same last vowel. On the other hand, you cannot form any beautiful lyric with the word "codeforces".
In the second example, you cannot form any beautiful lyric from given words.
In the third example, you can use the word "same" up to three times.
Submitted Solution:
```
"""
NTC here
"""
from sys import stdin, setrecursionlimit
setrecursionlimit(10**7)
def iin(): return int(stdin.readline())
def lin(): return list(map(int, stdin.readline().split()))
def main():
n=iin()
dc={}
vowel={'a','e','i','o','u'}
a1=[]
for i in range(n):
w=input()
a1.append(w)
ch,v=0,'z'
for j in w:
if j in vowel:
ch+=1
v=j
try:
dc[(ch,v)].append(i)
except:
dc[(ch,v)]=[i]
left={}
select=[]
ans=[]
for i in dc:
j=0
l=len(dc[i])
while j<l-1:
select.append([dc[i][j],dc[i][j+1]])
j+=2
if l%2:
x,y=i
try:
left[x].append(dc[i][-1])
except:
left[x]=[dc[i][-1]]
select2=[]
for i in left:
j=0
l=len(left[i])
while j<l-1:
select2.append([left[i][j],left[i][j+1]])
j+=2
i,j=0,0
c1,c2=len(select),len(select2)
while i<c1 and j<c2:
ans.append(select[i]+select2[j])
i+=1
j+=1
while i<c1-1:
ans.append(select[i]+select[i+1])
i+=2
print(len(ans))
for i,j,k,l in ans:
print(a1[k],a1[i])
print(a1[l],a1[j])
main()
# try:
# main()
# except Exception as e: print(e)
``` | instruction | 0 | 78,363 | 18 | 156,726 |
Yes | output | 1 | 78,363 | 18 | 156,727 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line consists of two words separated by whitespace.
A lyric is beautiful if and only if it satisfies all conditions below.
* The number of vowels in the first word of the first line is the same as the number of vowels in the first word of the second line.
* The number of vowels in the second word of the first line is the same as the number of vowels in the second word of the second line.
* The last vowel of the first line is the same as the last vowel of the second line. Note that there may be consonants after the vowel.
Also, letters "a", "e", "o", "i", and "u" are vowels. Note that "y" is never vowel.
For example of a beautiful lyric,
"hello hellooowww"
"whatsup yowowowow"
is a beautiful lyric because there are two vowels each in "hello" and "whatsup", four vowels each in "hellooowww" and "yowowowow" (keep in mind that "y" is not a vowel), and the last vowel of each line is "o".
For example of a not beautiful lyric,
"hey man"
"iam mcdic"
is not a beautiful lyric because "hey" and "iam" don't have same number of vowels and the last vowels of two lines are different ("a" in the first and "i" in the second).
How many beautiful lyrics can you write from given words? Note that you cannot use a word more times than it is given to you. For example, if a word is given three times, you can use it at most three times.
Input
The first line contains single integer n (1 ≤ n ≤ 10^{5}) — the number of words.
The i-th of the next n lines contains string s_{i} consisting lowercase alphabet letters — the i-th word. It is guaranteed that the sum of the total word length is equal or less than 10^{6}. Each word contains at least one vowel.
Output
In the first line, print m — the number of maximum possible beautiful lyrics.
In next 2m lines, print m beautiful lyrics (two lines per lyric).
If there are multiple answers, print any.
Examples
Input
14
wow
this
is
the
first
mcdics
codeforces
round
hooray
i
am
proud
about
that
Output
3
about proud
hooray round
wow first
this is
i that
mcdics am
Input
7
arsijo
suggested
the
idea
for
this
problem
Output
0
Input
4
same
same
same
differ
Output
1
same differ
same same
Note
In the first example, those beautiful lyrics are one of the possible answers. Let's look at the first lyric on the sample output of the first example. "about proud hooray round" forms a beautiful lyric because "about" and "hooray" have same number of vowels, "proud" and "round" have same number of vowels, and both lines have same last vowel. On the other hand, you cannot form any beautiful lyric with the word "codeforces".
In the second example, you cannot form any beautiful lyric from given words.
In the third example, you can use the word "same" up to three times.
Submitted Solution:
```
#import sys
#sys.stdin = open('inC', 'r')
#a = [int(x) for x in input().split()]
#n,m = map(int, input().split())
vowels = 'aeoiu'
d = {}
d2 = {}
n = int(input())
pairs1 = []
pairs2 = []
for i in range(n):
w = input()
cnt = 0
lst = '-'
for c in w:
if c in vowels:
lst = c
cnt += 1
key = str(cnt)+lst
if key in d:
pairs2.append((w, d[key]))
del d[key]
else:
d[key] = w
for k in d:
k2 = k[:-1]
if k2 in d2:
pairs1.append((d[k], d2[k2]))
del d2[k2]
else:
d2[k2] = d[k]
l2 = len(pairs2)
r1 = min(len(pairs1), l2)
r2 = (l2 - r1) // 2
r2 = r2 if r2 >= 0 else 0
print(r1+r2)
for i in range(r1):
print(pairs1[i][0], pairs2[i][0])
print(pairs1[i][1], pairs2[i][1])
j = r1
while j + 1 < l2:
print(pairs2[j][0], pairs2[j+1][0])
print(pairs2[j][1], pairs2[j+1][1])
j += 2
``` | instruction | 0 | 78,364 | 18 | 156,728 |
Yes | output | 1 | 78,364 | 18 | 156,729 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line consists of two words separated by whitespace.
A lyric is beautiful if and only if it satisfies all conditions below.
* The number of vowels in the first word of the first line is the same as the number of vowels in the first word of the second line.
* The number of vowels in the second word of the first line is the same as the number of vowels in the second word of the second line.
* The last vowel of the first line is the same as the last vowel of the second line. Note that there may be consonants after the vowel.
Also, letters "a", "e", "o", "i", and "u" are vowels. Note that "y" is never vowel.
For example of a beautiful lyric,
"hello hellooowww"
"whatsup yowowowow"
is a beautiful lyric because there are two vowels each in "hello" and "whatsup", four vowels each in "hellooowww" and "yowowowow" (keep in mind that "y" is not a vowel), and the last vowel of each line is "o".
For example of a not beautiful lyric,
"hey man"
"iam mcdic"
is not a beautiful lyric because "hey" and "iam" don't have same number of vowels and the last vowels of two lines are different ("a" in the first and "i" in the second).
How many beautiful lyrics can you write from given words? Note that you cannot use a word more times than it is given to you. For example, if a word is given three times, you can use it at most three times.
Input
The first line contains single integer n (1 ≤ n ≤ 10^{5}) — the number of words.
The i-th of the next n lines contains string s_{i} consisting lowercase alphabet letters — the i-th word. It is guaranteed that the sum of the total word length is equal or less than 10^{6}. Each word contains at least one vowel.
Output
In the first line, print m — the number of maximum possible beautiful lyrics.
In next 2m lines, print m beautiful lyrics (two lines per lyric).
If there are multiple answers, print any.
Examples
Input
14
wow
this
is
the
first
mcdics
codeforces
round
hooray
i
am
proud
about
that
Output
3
about proud
hooray round
wow first
this is
i that
mcdics am
Input
7
arsijo
suggested
the
idea
for
this
problem
Output
0
Input
4
same
same
same
differ
Output
1
same differ
same same
Note
In the first example, those beautiful lyrics are one of the possible answers. Let's look at the first lyric on the sample output of the first example. "about proud hooray round" forms a beautiful lyric because "about" and "hooray" have same number of vowels, "proud" and "round" have same number of vowels, and both lines have same last vowel. On the other hand, you cannot form any beautiful lyric with the word "codeforces".
In the second example, you cannot form any beautiful lyric from given words.
In the third example, you can use the word "same" up to three times.
Submitted Solution:
```
n = int(input())
d = {}
ish = {'a', 'e', 'o', 'i', 'u'}
def last_g(x):
for el in x[::-1]:
if el in ish:
return el
for i in range(n):
s = input()
count = s.count('a') + s.count('e') + s.count('o') + s.count('i') + s.count('u')
if count in d:
d[count].append(s)
else:
d[count] = [s]
firsts = []
seconds = []
for e in d:
gd = {'a': [], 'e': [], 'o': [], 'i': [], 'u': []}
pairs = []
for s in d[e]:
gd[last_g(s)].append(s)
for b in gd:
for i in range(0, len(gd[b])-1, 2):
seconds.append((gd[b][i], gd[b][i+1]))
if len(gd[b])%2 == 1:
pairs.append(gd[b][-1])
for i in range(0, len(pairs)-1, 2):
firsts.append((pairs[i], pairs[i+1]))
q = len(seconds)
m = len(firsts)
if m >= q:
print(q)
for i in range(q):
print(firsts[i][0] + ' ' + seconds[i][0])
print(firsts[i][1] + ' ' + seconds[i][1])
else:
print(m + (q - m)//2)
for i in range(m):
print(firsts[i][0] + ' ' + seconds[i][0])
print(firsts[i][1] + ' ' + seconds[i][1])
for i in range(m, q-1, 2):
print(seconds[i][0] + ' ' + seconds[i+1][0])
print(seconds[i][1] + ' ' + seconds[i+1][1])
``` | instruction | 0 | 78,365 | 18 | 156,730 |
Yes | output | 1 | 78,365 | 18 | 156,731 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line consists of two words separated by whitespace.
A lyric is beautiful if and only if it satisfies all conditions below.
* The number of vowels in the first word of the first line is the same as the number of vowels in the first word of the second line.
* The number of vowels in the second word of the first line is the same as the number of vowels in the second word of the second line.
* The last vowel of the first line is the same as the last vowel of the second line. Note that there may be consonants after the vowel.
Also, letters "a", "e", "o", "i", and "u" are vowels. Note that "y" is never vowel.
For example of a beautiful lyric,
"hello hellooowww"
"whatsup yowowowow"
is a beautiful lyric because there are two vowels each in "hello" and "whatsup", four vowels each in "hellooowww" and "yowowowow" (keep in mind that "y" is not a vowel), and the last vowel of each line is "o".
For example of a not beautiful lyric,
"hey man"
"iam mcdic"
is not a beautiful lyric because "hey" and "iam" don't have same number of vowels and the last vowels of two lines are different ("a" in the first and "i" in the second).
How many beautiful lyrics can you write from given words? Note that you cannot use a word more times than it is given to you. For example, if a word is given three times, you can use it at most three times.
Input
The first line contains single integer n (1 ≤ n ≤ 10^{5}) — the number of words.
The i-th of the next n lines contains string s_{i} consisting lowercase alphabet letters — the i-th word. It is guaranteed that the sum of the total word length is equal or less than 10^{6}. Each word contains at least one vowel.
Output
In the first line, print m — the number of maximum possible beautiful lyrics.
In next 2m lines, print m beautiful lyrics (two lines per lyric).
If there are multiple answers, print any.
Examples
Input
14
wow
this
is
the
first
mcdics
codeforces
round
hooray
i
am
proud
about
that
Output
3
about proud
hooray round
wow first
this is
i that
mcdics am
Input
7
arsijo
suggested
the
idea
for
this
problem
Output
0
Input
4
same
same
same
differ
Output
1
same differ
same same
Note
In the first example, those beautiful lyrics are one of the possible answers. Let's look at the first lyric on the sample output of the first example. "about proud hooray round" forms a beautiful lyric because "about" and "hooray" have same number of vowels, "proud" and "round" have same number of vowels, and both lines have same last vowel. On the other hand, you cannot form any beautiful lyric with the word "codeforces".
In the second example, you cannot form any beautiful lyric from given words.
In the third example, you can use the word "same" up to three times.
Submitted Solution:
```
n = int(input())
lyrics = []
seq = {}
vowels = ['a', 'e', 'i', 'o', 'u']
for i in range(n):
tmp = input()
lyrics.append(tmp)
cnt = 0
last = '-'
for s in tmp:
if s in vowels:
last = vowels.index(s)
cnt += 1
# print(tmp, last, cnt)
try:
seq[cnt]
except KeyError:
seq[cnt] = [[] for x in range(5)]
seq[cnt][last].append(i)
# print(seq)
odd = []
pair = []
for key, val in seq.items():
# print(key, val)
for x in val:
i = len(x)
if (i % 2 == 1):
odd.append(x[-1])
x = x[:-1]
pair.extend(x)
if (len(odd) % 2 == 1):
odd = odd[:-1]
# print(odd, pair)
# print(odd, pair)
lo = len(odd)//2
lp = len(pair)//2
# print(lo, lp)
m = min(((lo+lp)//2), lp)
print(m)
ans = [-1 for x in range(m*4)]
# print(m, len(odd))
for i in range(len(odd)):
try:
ans[i*2] = odd[i]
except IndexError:
break
cnt = 0
i = 0
while i < m*4:
if (i < len(odd)*2):
if (ans[i] == -1):
ans[i] = pair[cnt]
cnt += 1
else:
ans[i] = pair[cnt]
ans[i+1] = pair[cnt+2]
ans[i+2] = pair[cnt+1]
ans[i+3] = pair[cnt+3]
cnt += 4
i += 3
i += 1
for i in range(len(ans)//2):
print(lyrics[ans[2*i]], lyrics[ans[2*i+1]])
# for i in range(min(lo, m)):
# print(lyrics[odd[2*i]], lyrics[pair[2*i]])
# print(lyrics[odd[2*i+1]], lyrics[pair[2*i+1]])
# for i in range(max((lp-lo)//2, 0)):
# print(lyrics[pair[(lo+i)*2]], lyrics[pair[(lo+i)*2+2]])
# print(lyrics[pair[(lo+i)*2+1]], lyrics[pair[(lo+i)*2+3]])
``` | instruction | 0 | 78,366 | 18 | 156,732 |
Yes | output | 1 | 78,366 | 18 | 156,733 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line consists of two words separated by whitespace.
A lyric is beautiful if and only if it satisfies all conditions below.
* The number of vowels in the first word of the first line is the same as the number of vowels in the first word of the second line.
* The number of vowels in the second word of the first line is the same as the number of vowels in the second word of the second line.
* The last vowel of the first line is the same as the last vowel of the second line. Note that there may be consonants after the vowel.
Also, letters "a", "e", "o", "i", and "u" are vowels. Note that "y" is never vowel.
For example of a beautiful lyric,
"hello hellooowww"
"whatsup yowowowow"
is a beautiful lyric because there are two vowels each in "hello" and "whatsup", four vowels each in "hellooowww" and "yowowowow" (keep in mind that "y" is not a vowel), and the last vowel of each line is "o".
For example of a not beautiful lyric,
"hey man"
"iam mcdic"
is not a beautiful lyric because "hey" and "iam" don't have same number of vowels and the last vowels of two lines are different ("a" in the first and "i" in the second).
How many beautiful lyrics can you write from given words? Note that you cannot use a word more times than it is given to you. For example, if a word is given three times, you can use it at most three times.
Input
The first line contains single integer n (1 ≤ n ≤ 10^{5}) — the number of words.
The i-th of the next n lines contains string s_{i} consisting lowercase alphabet letters — the i-th word. It is guaranteed that the sum of the total word length is equal or less than 10^{6}. Each word contains at least one vowel.
Output
In the first line, print m — the number of maximum possible beautiful lyrics.
In next 2m lines, print m beautiful lyrics (two lines per lyric).
If there are multiple answers, print any.
Examples
Input
14
wow
this
is
the
first
mcdics
codeforces
round
hooray
i
am
proud
about
that
Output
3
about proud
hooray round
wow first
this is
i that
mcdics am
Input
7
arsijo
suggested
the
idea
for
this
problem
Output
0
Input
4
same
same
same
differ
Output
1
same differ
same same
Note
In the first example, those beautiful lyrics are one of the possible answers. Let's look at the first lyric on the sample output of the first example. "about proud hooray round" forms a beautiful lyric because "about" and "hooray" have same number of vowels, "proud" and "round" have same number of vowels, and both lines have same last vowel. On the other hand, you cannot form any beautiful lyric with the word "codeforces".
In the second example, you cannot form any beautiful lyric from given words.
In the third example, you can use the word "same" up to three times.
Submitted Solution:
```
import sys
def key(s):
a = list(filter(lambda x: x in ('a', 'e', 'o', 'i', 'u'), s))
return len(a), a[-1]
if __name__ == '__main__':
n = int(input())
ss = map(lambda x: x.strip(), sys.stdin.readlines())
srt = sorted(ss, key=key)
pairs = []
tmp = []
i = 0
while i < n - 1:
k1 = key(srt[i])
k2 = key(srt[i+1])
if k1 == k2:
pairs.append((srt[i], srt[i+1]))
i += 2
else:
tmp.append(srt[i])
if i == n - 2:
tmp.append(srt[i+1])
i += 1
rest = []
i = 0
while i < len(tmp) - 1:
k1 = key(tmp[i])
k2 = key(tmp[i + 1])
if k1[0] == k2[0]:
rest.append((tmp[i], tmp[i + 1]))
i += 2
else:
i += 1
if len(pairs) <= len(rest):
result = list(zip(rest, pairs))
else:
off = (len(pairs) - len(rest)) // 2
result = list(zip(rest + pairs[(len(pairs) - off):], pairs[:(len(pairs) - off)]))
print(len(result))
output = []
for l, r in result:
output.append("%s %s" % (l[0], r[0]))
output.append("%s %s" % (l[1], r[1]))
print("\n".join(output))
``` | instruction | 0 | 78,367 | 18 | 156,734 |
No | output | 1 | 78,367 | 18 | 156,735 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line consists of two words separated by whitespace.
A lyric is beautiful if and only if it satisfies all conditions below.
* The number of vowels in the first word of the first line is the same as the number of vowels in the first word of the second line.
* The number of vowels in the second word of the first line is the same as the number of vowels in the second word of the second line.
* The last vowel of the first line is the same as the last vowel of the second line. Note that there may be consonants after the vowel.
Also, letters "a", "e", "o", "i", and "u" are vowels. Note that "y" is never vowel.
For example of a beautiful lyric,
"hello hellooowww"
"whatsup yowowowow"
is a beautiful lyric because there are two vowels each in "hello" and "whatsup", four vowels each in "hellooowww" and "yowowowow" (keep in mind that "y" is not a vowel), and the last vowel of each line is "o".
For example of a not beautiful lyric,
"hey man"
"iam mcdic"
is not a beautiful lyric because "hey" and "iam" don't have same number of vowels and the last vowels of two lines are different ("a" in the first and "i" in the second).
How many beautiful lyrics can you write from given words? Note that you cannot use a word more times than it is given to you. For example, if a word is given three times, you can use it at most three times.
Input
The first line contains single integer n (1 ≤ n ≤ 10^{5}) — the number of words.
The i-th of the next n lines contains string s_{i} consisting lowercase alphabet letters — the i-th word. It is guaranteed that the sum of the total word length is equal or less than 10^{6}. Each word contains at least one vowel.
Output
In the first line, print m — the number of maximum possible beautiful lyrics.
In next 2m lines, print m beautiful lyrics (two lines per lyric).
If there are multiple answers, print any.
Examples
Input
14
wow
this
is
the
first
mcdics
codeforces
round
hooray
i
am
proud
about
that
Output
3
about proud
hooray round
wow first
this is
i that
mcdics am
Input
7
arsijo
suggested
the
idea
for
this
problem
Output
0
Input
4
same
same
same
differ
Output
1
same differ
same same
Note
In the first example, those beautiful lyrics are one of the possible answers. Let's look at the first lyric on the sample output of the first example. "about proud hooray round" forms a beautiful lyric because "about" and "hooray" have same number of vowels, "proud" and "round" have same number of vowels, and both lines have same last vowel. On the other hand, you cannot form any beautiful lyric with the word "codeforces".
In the second example, you cannot form any beautiful lyric from given words.
In the third example, you can use the word "same" up to three times.
Submitted Solution:
```
n = int(input())
d = {}
set1 = {'a','e','i','o','u'}
for i in range(n):
inp = input()
a = 0
for c in inp:
if c in set1:
a+=1
if a in d:
d[a].append(inp)
else:
d[a] = [inp]
d2 = {}
for key in d.keys():
if len(d[key]) > 1:
d2[key] = len(d[key])//2
print(sum(d2.keys())//2)
def func(v1, v2):
if v1 == v2:
print(d[v1][0], d[v1][1])
print(d[v1][2], d[v1][3])
d[v1] = d[v1][4:]
else:
print(d[v1][0], d[v2][0])
print(d[v1][1], d[v2][1])
d[v1] = d[v1][2:]
d[v2] = d[v2][2:]
l = sorted(d2.items(),key=lambda x:x[0],reverse=True)
l = ''.join([str(x[0])*x[1] for x in l])
for i in range(len(l)//2):
func(int(l[i*2]),int(l[i*2+1]))
``` | instruction | 0 | 78,368 | 18 | 156,736 |
No | output | 1 | 78,368 | 18 | 156,737 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line consists of two words separated by whitespace.
A lyric is beautiful if and only if it satisfies all conditions below.
* The number of vowels in the first word of the first line is the same as the number of vowels in the first word of the second line.
* The number of vowels in the second word of the first line is the same as the number of vowels in the second word of the second line.
* The last vowel of the first line is the same as the last vowel of the second line. Note that there may be consonants after the vowel.
Also, letters "a", "e", "o", "i", and "u" are vowels. Note that "y" is never vowel.
For example of a beautiful lyric,
"hello hellooowww"
"whatsup yowowowow"
is a beautiful lyric because there are two vowels each in "hello" and "whatsup", four vowels each in "hellooowww" and "yowowowow" (keep in mind that "y" is not a vowel), and the last vowel of each line is "o".
For example of a not beautiful lyric,
"hey man"
"iam mcdic"
is not a beautiful lyric because "hey" and "iam" don't have same number of vowels and the last vowels of two lines are different ("a" in the first and "i" in the second).
How many beautiful lyrics can you write from given words? Note that you cannot use a word more times than it is given to you. For example, if a word is given three times, you can use it at most three times.
Input
The first line contains single integer n (1 ≤ n ≤ 10^{5}) — the number of words.
The i-th of the next n lines contains string s_{i} consisting lowercase alphabet letters — the i-th word. It is guaranteed that the sum of the total word length is equal or less than 10^{6}. Each word contains at least one vowel.
Output
In the first line, print m — the number of maximum possible beautiful lyrics.
In next 2m lines, print m beautiful lyrics (two lines per lyric).
If there are multiple answers, print any.
Examples
Input
14
wow
this
is
the
first
mcdics
codeforces
round
hooray
i
am
proud
about
that
Output
3
about proud
hooray round
wow first
this is
i that
mcdics am
Input
7
arsijo
suggested
the
idea
for
this
problem
Output
0
Input
4
same
same
same
differ
Output
1
same differ
same same
Note
In the first example, those beautiful lyrics are one of the possible answers. Let's look at the first lyric on the sample output of the first example. "about proud hooray round" forms a beautiful lyric because "about" and "hooray" have same number of vowels, "proud" and "round" have same number of vowels, and both lines have same last vowel. On the other hand, you cannot form any beautiful lyric with the word "codeforces".
In the second example, you cannot form any beautiful lyric from given words.
In the third example, you can use the word "same" up to three times.
Submitted Solution:
```
n = int(input())
cort = {}
numbers_cort = {}
numbers = {}
numbers_strings = {}
a = set(['a', 'e', 'o', 'i', 'u'])
for i in range(n):
s = input()
k = 0
last = ''
for j in s:
if j in a:
last = j
k += 1
if (k, last) in cort.keys():
cort[(k, last)].append(s)
else:
cort[(k, last)] = [s]
if k in numbers_strings.keys():
numbers_strings[k].append(s)
else:
numbers_strings[k] = [s]
if (k, last) in numbers_cort.keys():
numbers_cort[(k, last)] += 1
else:
numbers_cort[(k, last)] = 1
if k in numbers.keys():
numbers[k] += 1
else:
numbers[k] = 1
first = []
second = []
s = 0
s1 = 0
for i in numbers_cort.keys():
s += numbers_cort[i] // 2
numbers[i[0]] -= numbers_cort[i] // 2
if len(cort[i]) % 2 == 0:
first += cort[i]
numbers_strings[i[0]] = list(filter(lambda x: x not in cort[i], numbers_strings[i[0]]))
else:
first += cort[i][:len(cort[i]) - 1]
numbers_strings[i[0]] = list(filter(lambda x: x not in cort[i][:len(cort[i]) - 1],numbers_strings[i[0]]))
for i in numbers.keys():
s1 += numbers[i] // 2
if len(numbers_strings[i]) % 2 == 0:
second += numbers_strings[i]
else:
second += numbers_strings[i][:len(numbers_strings[i]) - 1]
if len(first) >= len(second):
z = (s + s1) // 2
print(z)
while len(first) != 0 and len(second) != 0:
print(second.pop(0), first.pop(0))
while len(first) != 0:
print(first.pop(0), first.pop(0))
else:
z = s // 2
print(z)
while len(first) != 0:
print(second.pop(0), first.pop(0))
``` | instruction | 0 | 78,369 | 18 | 156,738 |
No | output | 1 | 78,369 | 18 | 156,739 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line consists of two words separated by whitespace.
A lyric is beautiful if and only if it satisfies all conditions below.
* The number of vowels in the first word of the first line is the same as the number of vowels in the first word of the second line.
* The number of vowels in the second word of the first line is the same as the number of vowels in the second word of the second line.
* The last vowel of the first line is the same as the last vowel of the second line. Note that there may be consonants after the vowel.
Also, letters "a", "e", "o", "i", and "u" are vowels. Note that "y" is never vowel.
For example of a beautiful lyric,
"hello hellooowww"
"whatsup yowowowow"
is a beautiful lyric because there are two vowels each in "hello" and "whatsup", four vowels each in "hellooowww" and "yowowowow" (keep in mind that "y" is not a vowel), and the last vowel of each line is "o".
For example of a not beautiful lyric,
"hey man"
"iam mcdic"
is not a beautiful lyric because "hey" and "iam" don't have same number of vowels and the last vowels of two lines are different ("a" in the first and "i" in the second).
How many beautiful lyrics can you write from given words? Note that you cannot use a word more times than it is given to you. For example, if a word is given three times, you can use it at most three times.
Input
The first line contains single integer n (1 ≤ n ≤ 10^{5}) — the number of words.
The i-th of the next n lines contains string s_{i} consisting lowercase alphabet letters — the i-th word. It is guaranteed that the sum of the total word length is equal or less than 10^{6}. Each word contains at least one vowel.
Output
In the first line, print m — the number of maximum possible beautiful lyrics.
In next 2m lines, print m beautiful lyrics (two lines per lyric).
If there are multiple answers, print any.
Examples
Input
14
wow
this
is
the
first
mcdics
codeforces
round
hooray
i
am
proud
about
that
Output
3
about proud
hooray round
wow first
this is
i that
mcdics am
Input
7
arsijo
suggested
the
idea
for
this
problem
Output
0
Input
4
same
same
same
differ
Output
1
same differ
same same
Note
In the first example, those beautiful lyrics are one of the possible answers. Let's look at the first lyric on the sample output of the first example. "about proud hooray round" forms a beautiful lyric because "about" and "hooray" have same number of vowels, "proud" and "round" have same number of vowels, and both lines have same last vowel. On the other hand, you cannot form any beautiful lyric with the word "codeforces".
In the second example, you cannot form any beautiful lyric from given words.
In the third example, you can use the word "same" up to three times.
Submitted Solution:
```
import sys
from collections import defaultdict as dd
from collections import deque
from functools import *
from fractions import Fraction as f
from copy import *
from bisect import *
from heapq import *
from math import *
from itertools import permutations
def eprint(*args):
print(*args, file=sys.stderr)
zz=1
#sys.setrecursionlimit(10**6)
if zz:
input=sys.stdin.readline
else:
sys.stdin=open('input.txt', 'r')
sys.stdout=open('all.txt','w')
def inc(d,c):
d[c]=d[c]+1 if c in d else 1
def li():
return [int(xx) for xx in input().split()]
def fli():
return [float(x) for x in input().split()]
def comp(a,b):
if(a>b):
return 2
return 2 if a==b else 0
def gi():
return [xx for xx in input().split()]
def fi():
return int(input())
def pro(a):
return reduce(lambda a,b:a*b,a)
def swap(a,i,j):
a[i],a[j]=a[j],a[i]
def si():
return list(input().rstrip())
def mi():
return map(int,input().split())
def gh():
sys.stdout.flush()
def graph(n,m):
for i in range(m):
x,y=mi()
a[x].append(y)
a[y].append(x)
def bo(i):
return ord(i)-ord('a')
def ck(x,y):
return int(bin(x)[2:]+bin(y)[2:],2)
n=fi()
v=['a','e','i','o','u']
dv={'a':0,'e':1,'i':2,'o':3,'u':4}
fg={}
for _ in range(n):
s=si()
lv=5
vc=0
for i in range(len(s)):
if s[i] in v:
vc+=1
lv=dv[s[i]]
if vc not in fg:
fg[vc]=[[] for j in range(6)]
fg[vc][lv].append("".join(s))
r=[[],[]]
for i in fg:
for j in range(6):
k=(len(fg[i][j])//2)*2
for p in range(k):
r[0].append(fg[i][j][p])
for p in range(k,len(fg[i][j])):
r[1].append(fg[i][j][p])
ly=[]
while len(r[1])<2:
if len(r[0])>2:
r[1].append(r[0][-1])
r[0].pop()
else:
break
while len(r[0])>=2 and len(r[1])>=2:
p=[]
p.append(r[1][-1])
p.append(r[0][-1])
r[0].pop()
r[1].pop()
p.append(r[1][-1])
p.append(r[0][-1])
r[0].pop()
r[1].pop()
while len(r[1])<2:
if len(r[0])>2:
r[1].append(r[0][-1])
r[0].pop()
else:
break
ly.append(p)
print(len(ly))
for i in ly:
print(i[0],i[1])
print(i[2],i[3])
``` | instruction | 0 | 78,370 | 18 | 156,740 |
No | output | 1 | 78,370 | 18 | 156,741 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Developers often face with regular expression patterns. A pattern is usually defined as a string consisting of characters and metacharacters that sets the rules for your search. These patterns are most often used to check whether a particular string meets the certain rules.
In this task, a pattern will be a string consisting of small English letters and question marks ('?'). The question mark in the pattern is a metacharacter that denotes an arbitrary small letter of the English alphabet. We will assume that a string matches the pattern if we can transform the string into the pattern by replacing the question marks by the appropriate characters. For example, string aba matches patterns: ???, ??a, a?a, aba.
Programmers that work for the R1 company love puzzling each other (and themselves) with riddles. One of them is as follows: you are given n patterns of the same length, you need to find a pattern that contains as few question marks as possible, and intersects with each of the given patterns. Two patterns intersect if there is a string that matches both the first and the second pattern. Can you solve this riddle?
Input
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of patterns. Next n lines contain the patterns.
It is guaranteed that the patterns can only consist of small English letters and symbols '?'. All patterns are non-empty and have the same length. The total length of all the patterns does not exceed 105 characters.
Output
In a single line print the answer to the problem — the pattern with the minimal number of signs '?', which intersects with each of the given ones. If there are several answers, print any of them.
Examples
Input
2
?ab
??b
Output
xab
Input
2
a
b
Output
?
Input
1
?a?b
Output
cacb
Note
Consider the first example. Pattern xab intersects with each of the given patterns. Pattern ??? also intersects with each of the given patterns, but it contains more question signs, hence it is not an optimal answer. Clearly, xab is the optimal answer, because it doesn't contain any question sign. There are a lot of other optimal answers, for example: aab, bab, cab, dab and so on.
Submitted Solution:
```
import sys
import itertools
def main():
pattern_count = int(sys.stdin.readline())
patterns = itertools.islice(sys.stdin, pattern_count)
result = intersect_patterns(p.strip() for p in patterns)
print(result)
def intersect_patterns(lines):
return ''.join(_intersect_patterns(lines))
def _intersect_patterns(lines):
wildcard, fill = '?', 'x'
for column in zip(*lines):
remaining = set(char for char in column if char != wildcard)
if not remaining:
yield fill
elif len(remaining) == 1:
yield remaining.pop()
else:
yield wildcard
if __name__ == '__main__':
main()
``` | instruction | 0 | 78,625 | 18 | 157,250 |
Yes | output | 1 | 78,625 | 18 | 157,251 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Developers often face with regular expression patterns. A pattern is usually defined as a string consisting of characters and metacharacters that sets the rules for your search. These patterns are most often used to check whether a particular string meets the certain rules.
In this task, a pattern will be a string consisting of small English letters and question marks ('?'). The question mark in the pattern is a metacharacter that denotes an arbitrary small letter of the English alphabet. We will assume that a string matches the pattern if we can transform the string into the pattern by replacing the question marks by the appropriate characters. For example, string aba matches patterns: ???, ??a, a?a, aba.
Programmers that work for the R1 company love puzzling each other (and themselves) with riddles. One of them is as follows: you are given n patterns of the same length, you need to find a pattern that contains as few question marks as possible, and intersects with each of the given patterns. Two patterns intersect if there is a string that matches both the first and the second pattern. Can you solve this riddle?
Input
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of patterns. Next n lines contain the patterns.
It is guaranteed that the patterns can only consist of small English letters and symbols '?'. All patterns are non-empty and have the same length. The total length of all the patterns does not exceed 105 characters.
Output
In a single line print the answer to the problem — the pattern with the minimal number of signs '?', which intersects with each of the given ones. If there are several answers, print any of them.
Examples
Input
2
?ab
??b
Output
xab
Input
2
a
b
Output
?
Input
1
?a?b
Output
cacb
Note
Consider the first example. Pattern xab intersects with each of the given patterns. Pattern ??? also intersects with each of the given patterns, but it contains more question signs, hence it is not an optimal answer. Clearly, xab is the optimal answer, because it doesn't contain any question sign. There are a lot of other optimal answers, for example: aab, bab, cab, dab and so on.
Submitted Solution:
```
n = int(input())
a = [input() for i in range(n)]
m = len(a[0])
c = [set() for i in range(m)]
for j in range(m):
for i in range(n):
if a[i][j] != "?":
c[j].add(a[i][j])
print("".join("x" if len(s) < 1 else "?" if len(s) > 1 else s.pop() for s in c))
``` | instruction | 0 | 78,626 | 18 | 157,252 |
Yes | output | 1 | 78,626 | 18 | 157,253 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Developers often face with regular expression patterns. A pattern is usually defined as a string consisting of characters and metacharacters that sets the rules for your search. These patterns are most often used to check whether a particular string meets the certain rules.
In this task, a pattern will be a string consisting of small English letters and question marks ('?'). The question mark in the pattern is a metacharacter that denotes an arbitrary small letter of the English alphabet. We will assume that a string matches the pattern if we can transform the string into the pattern by replacing the question marks by the appropriate characters. For example, string aba matches patterns: ???, ??a, a?a, aba.
Programmers that work for the R1 company love puzzling each other (and themselves) with riddles. One of them is as follows: you are given n patterns of the same length, you need to find a pattern that contains as few question marks as possible, and intersects with each of the given patterns. Two patterns intersect if there is a string that matches both the first and the second pattern. Can you solve this riddle?
Input
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of patterns. Next n lines contain the patterns.
It is guaranteed that the patterns can only consist of small English letters and symbols '?'. All patterns are non-empty and have the same length. The total length of all the patterns does not exceed 105 characters.
Output
In a single line print the answer to the problem — the pattern with the minimal number of signs '?', which intersects with each of the given ones. If there are several answers, print any of them.
Examples
Input
2
?ab
??b
Output
xab
Input
2
a
b
Output
?
Input
1
?a?b
Output
cacb
Note
Consider the first example. Pattern xab intersects with each of the given patterns. Pattern ??? also intersects with each of the given patterns, but it contains more question signs, hence it is not an optimal answer. Clearly, xab is the optimal answer, because it doesn't contain any question sign. There are a lot of other optimal answers, for example: aab, bab, cab, dab and so on.
Submitted Solution:
```
n = int(input())
s = input().strip()
a = [set() for i in range(len(s))]
for j in range(len(s)):
if s[j] != '?':
a[j].add(s[j])
for i in range(n - 1):
s = input().strip()
for j in range(len(s)):
if s[j] != '?':
a[j].add(s[j])
for i in range(len(a)):
if len(a[i]) > 1:
print('?', end = '')
elif len(a[i]) == 0:
print('a', end = '')
else:
print(list(a[i])[0], end = '')
``` | instruction | 0 | 78,627 | 18 | 157,254 |
Yes | output | 1 | 78,627 | 18 | 157,255 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Developers often face with regular expression patterns. A pattern is usually defined as a string consisting of characters and metacharacters that sets the rules for your search. These patterns are most often used to check whether a particular string meets the certain rules.
In this task, a pattern will be a string consisting of small English letters and question marks ('?'). The question mark in the pattern is a metacharacter that denotes an arbitrary small letter of the English alphabet. We will assume that a string matches the pattern if we can transform the string into the pattern by replacing the question marks by the appropriate characters. For example, string aba matches patterns: ???, ??a, a?a, aba.
Programmers that work for the R1 company love puzzling each other (and themselves) with riddles. One of them is as follows: you are given n patterns of the same length, you need to find a pattern that contains as few question marks as possible, and intersects with each of the given patterns. Two patterns intersect if there is a string that matches both the first and the second pattern. Can you solve this riddle?
Input
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of patterns. Next n lines contain the patterns.
It is guaranteed that the patterns can only consist of small English letters and symbols '?'. All patterns are non-empty and have the same length. The total length of all the patterns does not exceed 105 characters.
Output
In a single line print the answer to the problem — the pattern with the minimal number of signs '?', which intersects with each of the given ones. If there are several answers, print any of them.
Examples
Input
2
?ab
??b
Output
xab
Input
2
a
b
Output
?
Input
1
?a?b
Output
cacb
Note
Consider the first example. Pattern xab intersects with each of the given patterns. Pattern ??? also intersects with each of the given patterns, but it contains more question signs, hence it is not an optimal answer. Clearly, xab is the optimal answer, because it doesn't contain any question sign. There are a lot of other optimal answers, for example: aab, bab, cab, dab and so on.
Submitted Solution:
```
N = int(input())
S = []
ans = ''
sim = ''
for i in range(N):
S.append(input())
lenght = len(S[0])
for j in range(lenght):
M = 0
sim = S[0][j]
if sim=='?':
M+=1
for i in range(1,N):
if S[i][j]=='?':
M+=1
else:
if S[i][j]!=sim and sim!='?':
sim = '?'
else:
if sim=='?' and M==i:
sim=S[i][j]
if M==N :
sim ='a'
ans+=sim
print(ans)
``` | instruction | 0 | 78,628 | 18 | 157,256 |
Yes | output | 1 | 78,628 | 18 | 157,257 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Developers often face with regular expression patterns. A pattern is usually defined as a string consisting of characters and metacharacters that sets the rules for your search. These patterns are most often used to check whether a particular string meets the certain rules.
In this task, a pattern will be a string consisting of small English letters and question marks ('?'). The question mark in the pattern is a metacharacter that denotes an arbitrary small letter of the English alphabet. We will assume that a string matches the pattern if we can transform the string into the pattern by replacing the question marks by the appropriate characters. For example, string aba matches patterns: ???, ??a, a?a, aba.
Programmers that work for the R1 company love puzzling each other (and themselves) with riddles. One of them is as follows: you are given n patterns of the same length, you need to find a pattern that contains as few question marks as possible, and intersects with each of the given patterns. Two patterns intersect if there is a string that matches both the first and the second pattern. Can you solve this riddle?
Input
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of patterns. Next n lines contain the patterns.
It is guaranteed that the patterns can only consist of small English letters and symbols '?'. All patterns are non-empty and have the same length. The total length of all the patterns does not exceed 105 characters.
Output
In a single line print the answer to the problem — the pattern with the minimal number of signs '?', which intersects with each of the given ones. If there are several answers, print any of them.
Examples
Input
2
?ab
??b
Output
xab
Input
2
a
b
Output
?
Input
1
?a?b
Output
cacb
Note
Consider the first example. Pattern xab intersects with each of the given patterns. Pattern ??? also intersects with each of the given patterns, but it contains more question signs, hence it is not an optimal answer. Clearly, xab is the optimal answer, because it doesn't contain any question sign. There are a lot of other optimal answers, for example: aab, bab, cab, dab and so on.
Submitted Solution:
```
__author__ = 'Lipen'
def main():
n = int(input())
a = [list(input()) for _ in range(n)]
z = len(a[0])
template = ['!']*z
###
if n == 1:
q = ''
for i in range(z):
if a[0][i] == '?':
q += 'x'
else:
q += a[0][i]
print(q)
return
###
for w in range(z):
for i in range(n-1):
breaked = False
for j in range(i+1, n):
c = a[i][w]
v = a[j][w]
if c == '?':
if template[w] == '!':
# if v == '?':
# template[w] = '#'
# else:
# template[w] = v
if v != '?':
template[w] = v
elif v != '?' and v != template[w]:
template[w] = '?'
breaked = True
break
else:
if template[w] == '!':
if v == '?':
template[w] = c
elif v == c:
template[w] = c
elif v != c:
template[w] = '?'
breaked = True
break
elif v != '?':
template[w] = '?'
breaked = True
break
if breaked:
break
for i in range(z):
if template[i] == '!':
template[i] = 'x'
print(''.join(template))
main()
``` | instruction | 0 | 78,629 | 18 | 157,258 |
No | output | 1 | 78,629 | 18 | 157,259 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Developers often face with regular expression patterns. A pattern is usually defined as a string consisting of characters and metacharacters that sets the rules for your search. These patterns are most often used to check whether a particular string meets the certain rules.
In this task, a pattern will be a string consisting of small English letters and question marks ('?'). The question mark in the pattern is a metacharacter that denotes an arbitrary small letter of the English alphabet. We will assume that a string matches the pattern if we can transform the string into the pattern by replacing the question marks by the appropriate characters. For example, string aba matches patterns: ???, ??a, a?a, aba.
Programmers that work for the R1 company love puzzling each other (and themselves) with riddles. One of them is as follows: you are given n patterns of the same length, you need to find a pattern that contains as few question marks as possible, and intersects with each of the given patterns. Two patterns intersect if there is a string that matches both the first and the second pattern. Can you solve this riddle?
Input
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of patterns. Next n lines contain the patterns.
It is guaranteed that the patterns can only consist of small English letters and symbols '?'. All patterns are non-empty and have the same length. The total length of all the patterns does not exceed 105 characters.
Output
In a single line print the answer to the problem — the pattern with the minimal number of signs '?', which intersects with each of the given ones. If there are several answers, print any of them.
Examples
Input
2
?ab
??b
Output
xab
Input
2
a
b
Output
?
Input
1
?a?b
Output
cacb
Note
Consider the first example. Pattern xab intersects with each of the given patterns. Pattern ??? also intersects with each of the given patterns, but it contains more question signs, hence it is not an optimal answer. Clearly, xab is the optimal answer, because it doesn't contain any question sign. There are a lot of other optimal answers, for example: aab, bab, cab, dab and so on.
Submitted Solution:
```
n = int(input())
a = []
for i in range(n):
a.append(list(input()))
b = []
for i in range(len(a[0])):
b.append(set())
for j in range(len(a[0])):
for i in range(len(a)):
b[j].add(a[i][j])
for i in range(len(b)):
if len(b[i]) > 2:
print('?')
elif len(b[i]) == 2:
if '?' in b[i]:
b[i] = list(b[i])
if b[i][0] != '?':
print(b[i][0], end = '')
else:
print(b[i][1], end = '')
else:
print('?', end = '')
else:
if '?' in b[i]:
print('x',end = '')
else:
print(a[0][i], end = '')
``` | instruction | 0 | 78,630 | 18 | 157,260 |
No | output | 1 | 78,630 | 18 | 157,261 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Developers often face with regular expression patterns. A pattern is usually defined as a string consisting of characters and metacharacters that sets the rules for your search. These patterns are most often used to check whether a particular string meets the certain rules.
In this task, a pattern will be a string consisting of small English letters and question marks ('?'). The question mark in the pattern is a metacharacter that denotes an arbitrary small letter of the English alphabet. We will assume that a string matches the pattern if we can transform the string into the pattern by replacing the question marks by the appropriate characters. For example, string aba matches patterns: ???, ??a, a?a, aba.
Programmers that work for the R1 company love puzzling each other (and themselves) with riddles. One of them is as follows: you are given n patterns of the same length, you need to find a pattern that contains as few question marks as possible, and intersects with each of the given patterns. Two patterns intersect if there is a string that matches both the first and the second pattern. Can you solve this riddle?
Input
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of patterns. Next n lines contain the patterns.
It is guaranteed that the patterns can only consist of small English letters and symbols '?'. All patterns are non-empty and have the same length. The total length of all the patterns does not exceed 105 characters.
Output
In a single line print the answer to the problem — the pattern with the minimal number of signs '?', which intersects with each of the given ones. If there are several answers, print any of them.
Examples
Input
2
?ab
??b
Output
xab
Input
2
a
b
Output
?
Input
1
?a?b
Output
cacb
Note
Consider the first example. Pattern xab intersects with each of the given patterns. Pattern ??? also intersects with each of the given patterns, but it contains more question signs, hence it is not an optimal answer. Clearly, xab is the optimal answer, because it doesn't contain any question sign. There are a lot of other optimal answers, for example: aab, bab, cab, dab and so on.
Submitted Solution:
```
n = int(input())
l = []
for _ in range(n):
s = input()
l.append(s)
res = l[0]
x = 0
if n == 1:
res = res.replace('?', 'a')
elif n == 2 and len(l[0]) == 1:
if res == "?" and l[1][0] == "?":
res = 'a'
elif res.isalpha() and l[1][0].isalpha() and res != l[1][0]:
res = '?'
elif res == '?' and l[1][0].isalpha():
res = l[1][0]
else:
x += 1
else:
for i in range(1, len(l)):
for j in range(len(l[0])):
if res[j] == "?" and l[i][j] == "?":
res = res[:j] + 'a' + res[j + 1:]
elif res[j].isalpha() and l[i][j].isalpha() and res[j] != l[i][j]:
res = res[:j] + '?' + res[j + 1:]
elif res[j] == '?' and l[i][j].isalpha():
res = res[:j] + l[i][j] + res[j + 1:]
else:
continue
print(res)
``` | instruction | 0 | 78,631 | 18 | 157,262 |
No | output | 1 | 78,631 | 18 | 157,263 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Developers often face with regular expression patterns. A pattern is usually defined as a string consisting of characters and metacharacters that sets the rules for your search. These patterns are most often used to check whether a particular string meets the certain rules.
In this task, a pattern will be a string consisting of small English letters and question marks ('?'). The question mark in the pattern is a metacharacter that denotes an arbitrary small letter of the English alphabet. We will assume that a string matches the pattern if we can transform the string into the pattern by replacing the question marks by the appropriate characters. For example, string aba matches patterns: ???, ??a, a?a, aba.
Programmers that work for the R1 company love puzzling each other (and themselves) with riddles. One of them is as follows: you are given n patterns of the same length, you need to find a pattern that contains as few question marks as possible, and intersects with each of the given patterns. Two patterns intersect if there is a string that matches both the first and the second pattern. Can you solve this riddle?
Input
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of patterns. Next n lines contain the patterns.
It is guaranteed that the patterns can only consist of small English letters and symbols '?'. All patterns are non-empty and have the same length. The total length of all the patterns does not exceed 105 characters.
Output
In a single line print the answer to the problem — the pattern with the minimal number of signs '?', which intersects with each of the given ones. If there are several answers, print any of them.
Examples
Input
2
?ab
??b
Output
xab
Input
2
a
b
Output
?
Input
1
?a?b
Output
cacb
Note
Consider the first example. Pattern xab intersects with each of the given patterns. Pattern ??? also intersects with each of the given patterns, but it contains more question signs, hence it is not an optimal answer. Clearly, xab is the optimal answer, because it doesn't contain any question sign. There are a lot of other optimal answers, for example: aab, bab, cab, dab and so on.
Submitted Solution:
```
i_nap = int(input())
napisy = [input() for _ in range(i_nap)]
wynik = ""
for x in range(len(napisy[0])):
litera = napisy[0][x]
for y in range(1, i_nap):
if napisy[y][x] == "?":
continue
if napisy[y][x] != litera:
wynik += "?"
break
else:
if litera == "?":
wynik += "a"
else:
wynik += litera
print(wynik)
``` | instruction | 0 | 78,632 | 18 | 157,264 |
No | output | 1 | 78,632 | 18 | 157,265 |
Provide a correct Python 3 solution for this coding contest problem.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu | instruction | 0 | 78,892 | 18 | 157,784 |
"Correct Solution:
```
A = input().split(" ")
print(A[1] + A[0])
``` | output | 1 | 78,892 | 18 | 157,785 |
Provide a correct Python 3 solution for this coding contest problem.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu | instruction | 0 | 78,893 | 18 | 157,786 |
"Correct Solution:
```
s,t=[x for x in input().split()]
print(t+s)
``` | output | 1 | 78,893 | 18 | 157,787 |
Provide a correct Python 3 solution for this coding contest problem.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu | instruction | 0 | 78,894 | 18 | 157,788 |
"Correct Solution:
```
s, t = list(input().split())
print(t + s)
``` | output | 1 | 78,894 | 18 | 157,789 |
Provide a correct Python 3 solution for this coding contest problem.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu | instruction | 0 | 78,895 | 18 | 157,790 |
"Correct Solution:
```
str=input().split(" ")
print(str[1]+str[0])
``` | output | 1 | 78,895 | 18 | 157,791 |
Provide a correct Python 3 solution for this coding contest problem.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu | instruction | 0 | 78,896 | 18 | 157,792 |
"Correct Solution:
```
S=input().split()
print("".join(S[::-1]))
``` | output | 1 | 78,896 | 18 | 157,793 |
Provide a correct Python 3 solution for this coding contest problem.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu | instruction | 0 | 78,897 | 18 | 157,794 |
"Correct Solution:
```
S,T = input().split()
str=T+S
print(str)
``` | output | 1 | 78,897 | 18 | 157,795 |
Provide a correct Python 3 solution for this coding contest problem.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu | instruction | 0 | 78,898 | 18 | 157,796 |
"Correct Solution:
```
s=input().split()
a=s[1]+s[0]
print(a)
``` | output | 1 | 78,898 | 18 | 157,797 |
Provide a correct Python 3 solution for this coding contest problem.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu | instruction | 0 | 78,899 | 18 | 157,798 |
"Correct Solution:
```
S, T = input().split()
print(T + S)
``` | output | 1 | 78,899 | 18 | 157,799 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu
Submitted Solution:
```
# 2019/12/29
s,t=input().split()
print(t+s)
``` | instruction | 0 | 78,900 | 18 | 157,800 |
Yes | output | 1 | 78,900 | 18 | 157,801 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu
Submitted Solution:
```
string=input()
a,b=string.split()
print(b+a)
``` | instruction | 0 | 78,901 | 18 | 157,802 |
Yes | output | 1 | 78,901 | 18 | 157,803 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu
Submitted Solution:
```
a = input().split()
print(f"{a[1]}{a[0]}")
``` | instruction | 0 | 78,902 | 18 | 157,804 |
Yes | output | 1 | 78,902 | 18 | 157,805 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu
Submitted Solution:
```
s, t = input().split()
print(f"{t}{s}")
``` | instruction | 0 | 78,903 | 18 | 157,806 |
Yes | output | 1 | 78,903 | 18 | 157,807 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu
Submitted Solution:
```
s, t = map(int,input().split())
print(t+s)
``` | instruction | 0 | 78,904 | 18 | 157,808 |
No | output | 1 | 78,904 | 18 | 157,809 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu
Submitted Solution:
```
S,T = map(int,input().split())
print(f{T}{S})
``` | instruction | 0 | 78,905 | 18 | 157,810 |
No | output | 1 | 78,905 | 18 | 157,811 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu
Submitted Solution:
```
s, t = input().rstrip().split()
print(s + t)
``` | instruction | 0 | 78,906 | 18 | 157,812 |
No | output | 1 | 78,906 | 18 | 157,813 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
Constraints
* S and T are strings consisting of lowercase English letters.
* The lengths of S and T are between 1 and 100 (inclusive).
Input
Input is given from Standard Input in the following format:
S T
Output
Print the resulting string.
Examples
Input
oder atc
Output
atcoder
Input
humu humu
Output
humuhumu
Submitted Solution:
```
s=input("")
t=input("")
print(str(s)+str(t))
``` | instruction | 0 | 78,907 | 18 | 157,814 |
No | output | 1 | 78,907 | 18 | 157,815 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
Constraints
* |S|=3
* S consists of `a`, `b` and `c`.
Input
Input is given from Standard Input in the following format:
S
Output
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
Examples
Input
bac
Output
Yes
Input
bab
Output
No
Input
abc
Output
Yes
Input
aaa
Output
No
Submitted Solution:
```
print('Yes' if set(input())==set('abc') else 'No')
``` | instruction | 0 | 78,953 | 18 | 157,906 |
Yes | output | 1 | 78,953 | 18 | 157,907 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
Constraints
* |S|=3
* S consists of `a`, `b` and `c`.
Input
Input is given from Standard Input in the following format:
S
Output
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
Examples
Input
bac
Output
Yes
Input
bab
Output
No
Input
abc
Output
Yes
Input
aaa
Output
No
Submitted Solution:
```
S = input()
print("Yes" if "".join(sorted(S)) == "abc" else "No")
``` | instruction | 0 | 78,954 | 18 | 157,908 |
Yes | output | 1 | 78,954 | 18 | 157,909 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
Constraints
* |S|=3
* S consists of `a`, `b` and `c`.
Input
Input is given from Standard Input in the following format:
S
Output
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
Examples
Input
bac
Output
Yes
Input
bab
Output
No
Input
abc
Output
Yes
Input
aaa
Output
No
Submitted Solution:
```
s=input()
if len(set(s))==3:
print("Yes")
else:
print("No")
``` | instruction | 0 | 78,955 | 18 | 157,910 |
Yes | output | 1 | 78,955 | 18 | 157,911 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
Constraints
* |S|=3
* S consists of `a`, `b` and `c`.
Input
Input is given from Standard Input in the following format:
S
Output
If S can be obtained by permuting `abc`, print `Yes`; otherwise, print `No`.
Examples
Input
bac
Output
Yes
Input
bab
Output
No
Input
abc
Output
Yes
Input
aaa
Output
No
Submitted Solution:
```
S = set(input())
print("Yes" if S == {"a", "b", "c"} else "No")
``` | instruction | 0 | 78,956 | 18 | 157,912 |
Yes | output | 1 | 78,956 | 18 | 157,913 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.