description
stringlengths 171
4k
| code
stringlengths 94
3.98k
| normalized_code
stringlengths 57
4.99k
|
|---|---|---|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
m = list(s)
ch = s.split("@")
if len(s) < 3:
print("No solution")
elif s.count("@") == 0 or s[0] == "@" or s[len(s) - 1] == "@":
print("No solution")
else:
test = True
for i in range(1, len(ch) - 1):
if len(ch[i]) < 2:
test = False
break
if test == False:
print("No solution")
elif s.count("@") == 1:
print(s)
else:
c = ch[0] + "@"
for i in range(1, len(ch) - 1):
c += ch[i][0] + ","
for j in range(1, len(ch[i])):
c += ch[i][j]
c += "@"
c += ch[len(ch) - 1]
print(c)
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING IF FUNC_CALL VAR STRING NUMBER VAR NUMBER STRING VAR BIN_OP FUNC_CALL VAR VAR NUMBER STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER VAR BIN_OP VAR VAR NUMBER STRING FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR STRING VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
result, res, last, case, k = "", "", "", 0, 0
for i, x in enumerate(s):
if last == "":
if x == "@":
print("No solution")
k = 1
break
else:
res += x
elif x == "@":
if case == 1:
print("No solution")
k = 1
break
else:
case = 1
res += x
elif case == 1:
res += x
result += "," + res
res, last, case = "", "", 0
continue
else:
res += x
last = x
if k == 0:
if result == "" and res != "":
print("No solution")
elif x == "@":
print("No solution")
else:
print((result + res)[1:])
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR STRING STRING STRING NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER VAR VAR IF VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR VAR IF VAR NUMBER VAR VAR VAR BIN_OP STRING VAR ASSIGN VAR VAR VAR STRING STRING NUMBER VAR VAR ASSIGN VAR VAR IF VAR NUMBER IF VAR STRING VAR STRING EXPR FUNC_CALL VAR STRING IF VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP VAR VAR NUMBER
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
if "@" not in s:
print("No solution")
exit()
if s[0] == "@" or s[-1] == "@":
print("No solution")
exit()
s = s.split("@")
for i in s:
if i == "":
print("No solution")
exit()
ans = []
s1 = s[0]
for i in s[1:-1]:
if len(i) == 1:
print("No solution")
exit()
else:
s1 += "@"
s1 += i[0]
ans.append(s1)
s1 = i[1:]
s1 += "@" + s[-1]
ans.append(s1)
print(*ans, sep=",")
|
ASSIGN VAR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR NUMBER STRING VAR NUMBER STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING FOR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR VAR NUMBER FOR VAR VAR NUMBER NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR STRING VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER VAR BIN_OP STRING VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
a = []
b = []
x = 0
if s[0] == chr(64) or s[-1] == chr(64):
x += 1
else:
for i in range(len(s)):
if s[i] == chr(64):
a.append(i)
if len(a) == 1:
b.append(s)
elif len(a) == 0:
x += 1
else:
for i in range(1, len(a)):
if a[i] - a[i - 1] <= 2:
x += 1
b.append(s[0 : a[0] + 2])
for i in range(len(a)):
if i < len(a) - 2:
b.append(s[a[i] + 2 : a[i + 1] + 2])
elif i == len(a) - 2:
b.append(s[a[-2] + 2 : len(s)])
if x > 0:
print("No solution")
else:
print(",".join(b))
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER IF VAR NUMBER FUNC_CALL VAR NUMBER VAR NUMBER FUNC_CALL VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR VAR NUMBER BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
def solution():
s = input()
if "@" not in s:
return "No solution"
mas = s.split("@")
if len(mas[0]) < 1 or len(mas[-1]) < 1:
return "No solution"
front = mas[0]
back = mas[-1]
mas = mas[1 : len(mas) - 1]
for i in range(len(mas)):
if len(mas[i]) < 2:
return "No solution"
else:
mas[i] = mas[i][: len(mas[i]) // 2] + "," + mas[i][len(mas[i]) // 2 :]
return "@".join([front] + mas + [back])
print(solution())
|
FUNC_DEF ASSIGN VAR FUNC_CALL VAR IF STRING VAR RETURN STRING ASSIGN VAR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER NUMBER RETURN STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR NUMBER RETURN STRING ASSIGN VAR VAR BIN_OP BIN_OP VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER STRING VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER RETURN FUNC_CALL STRING BIN_OP BIN_OP LIST VAR VAR LIST VAR EXPR FUNC_CALL VAR FUNC_CALL VAR
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = str(input())
if s[0] == "@" or s[-1] == "@" or "@" not in s:
print("No solution")
else:
ans = []
n = len(s)
l = []
for i in range(n):
if s[i] == "@":
l.append(i)
lenl = len(l)
f = 0
for i in range(lenl - 1):
if l[i + 1] - l[i] <= 2:
f = 1
break
if f == 1:
print("No solution")
else:
base = 0
for i in range(lenl):
if i == lenl - 1:
ans.append(s[base:])
else:
ans.append(s[base : l[i] + 2])
base = l[i] + 2
lans = len(ans)
for i in range(lans):
if i == lans - 1:
print(ans[i])
else:
print(ans[i], end=",")
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER STRING VAR NUMBER STRING STRING VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR BIN_OP VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
l = len(s)
f = 0
s1 = ""
s2 = ""
ff = 0
list1 = []
for i in range(l):
if s[i] != "@":
if ff == 0:
s1 += s[i]
else:
s2 += s[i]
list1.append(s1 + "@" + s2)
s1 = ""
s2 = ""
ff = 0
elif s1 and ff == 0:
ff = 1
continue
else:
f = 1
break
if s1 != "" and ff == 0 and s2 == "" and f == 0 and list1:
list1[-1] += s1
s1 = ""
if f == 0 and s1 == "" and s2 == "" and f == 0 and list1:
for i in range(len(list1) - 1):
print(list1[i], end=",")
print(list1[-1])
else:
print("No solution")
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR NUMBER VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR STRING VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR STRING VAR NUMBER VAR STRING VAR NUMBER VAR VAR NUMBER VAR ASSIGN VAR STRING IF VAR NUMBER VAR STRING VAR STRING VAR NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR STRING EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input().split("@")
b = True
t = len(s)
if t < 2:
b = False
for i in range(t):
if i == 0 or i == t - 1:
if len(s[i]) < 1:
b = False
elif len(s[i]) < 2:
b = False
if b:
for i in range(t):
if 0 != i and i != t - 1:
print("%s,%s@" % (s[i][0:1], s[i][1 : len(s[i])]), end="")
else:
print("%s" % s[i], end="")
if i == 0:
print("%s" % "@", end="")
else:
print("No solution")
|
ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR FOR VAR FUNC_CALL VAR VAR IF NUMBER VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP STRING VAR VAR NUMBER NUMBER VAR VAR NUMBER FUNC_CALL VAR VAR VAR STRING EXPR FUNC_CALL VAR BIN_OP STRING VAR VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP STRING STRING STRING EXPR FUNC_CALL VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
try:
exit = s[::-1]
exit = len(exit) - exit.index("@") - 1
except ValueError:
print("No solution")
else:
if s[0] != "@" and s[len(s) - 1] != "@" and len(s) > 2:
mas = []
res = ""
t = True
for i in range(len(s)):
res = res + s[i]
if s[i] == "@":
if i != exit:
t = False
if s[i + 1] == "@" or s[i + 2] == "@":
break
continue
else:
t = True
if t == False:
t = True
mas.append(res)
res = ""
if i + 1 == len(s):
mas.append(res)
if t == True:
print(",".join(mas))
else:
print("No solution")
else:
print("No solution")
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER STRING VAR BIN_OP FUNC_CALL VAR VAR NUMBER STRING FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR STRING IF VAR VAR ASSIGN VAR NUMBER IF VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR STRING IF BIN_OP VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
import sys
def input():
return sys.stdin.readline().strip()
def iinput():
return int(input())
def tinput():
return input().split()
def rinput():
return map(int, tinput())
def rlinput():
return list(rinput())
address = input()
str = ""
i = 0
ans = []
n = len(address)
flag = False
while i < n:
if address[i] == "@":
if len(str) > 0 and i + 1 < n and address[i + 1] != "@":
ans.append(str + address[i] + address[i + 1])
str = ""
i += 1
else:
flag = True
break
else:
str = str + address[i]
i += 1
if flag or len(ans) == 0:
print("No solution")
else:
if len(str) != 0:
ans[-1] += str
print(*ans, sep=",")
|
IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR STRING IF FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR STRING VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR VAR NUMBER IF VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR EXPR FUNC_CALL VAR VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
import sys
def input():
return sys.stdin.readline().strip()
def iinput():
return int(input())
def rinput():
return map(int, sys.stdin.readline().strip().split())
def get_list():
return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
s = input()
l = len(s)
ans = []
prev = -1
flag = True
tot = s.count("@")
cnt = 0
if s[0] == "@" or s[l - 1] == "@" or tot == 0:
print("No solution")
sys.exit(0)
for i in range(l):
if s[i] == "@":
bef = s[prev + 1 : i]
aft = s[i + 1 :]
if "@" in aft:
aft = aft[: aft.index("@")]
if len(ans) > 0 and len(bef) < 1 or len(aft) == 0:
flag = False
break
if cnt != tot - 1:
ans.append(bef + "@" + aft[0])
else:
ans.append(bef + "@" + aft)
prev = i + 1
cnt += 1
if flag == False:
print("No solution")
else:
print(*ans, sep=",")
|
IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR NUMBER IF STRING VAR ASSIGN VAR VAR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR STRING VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR STRING VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
def main():
string = input()
comps = string.split("@")
ans = []
if "@" not in string:
print("No solution")
return
for i in range(len(comps)):
if i == 0 or i == len(comps) - 1:
if len(comps[i]) < 1:
print("No solution")
return
elif len(comps[i]) < 2:
print("No solution")
return
if len(comps) == 2:
print("@".join(comps))
return
for i in range(len(comps) - 1):
if i == 0:
ans.append(comps[i] + "@" + comps[i + 1][:1])
elif i == len(comps) - 2:
ans.append(comps[i][1:] + "@" + comps[i + 1])
else:
ans.append(comps[i][1:] + "@" + comps[i + 1][:1])
print(",".join(ans))
main()
|
FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR LIST IF STRING VAR EXPR FUNC_CALL VAR STRING RETURN FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN IF FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR RETURN FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR STRING VAR BIN_OP VAR NUMBER NUMBER IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER STRING VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER STRING VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = ("z" + input() + "z").split("@")
for i in s:
if len(i) < 2 or len(s) < 2:
print("No solution")
exit()
s[-1] = s[-1][:-1]
r = ""
for i in range(len(s) - 1):
r += s[i][1:] + "@" + s[i + 1][0] + ","
r = r[:-1] + s[-1][1:]
print(r)
|
ASSIGN VAR FUNC_CALL BIN_OP BIN_OP STRING FUNC_CALL VAR STRING STRING FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR NUMBER VAR NUMBER NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER STRING VAR BIN_OP VAR NUMBER NUMBER STRING ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
ans = s.split("@")
f = []
for i in ans:
f.append(len(i))
flag = 0
for p in range(1, len(f) - 1):
if f[p] <= 1:
flag = 1
break
if f[0] <= 0:
flag = 1
if f[-1] < 1:
flag = 1
if s.count("@") == 0:
flag = 1
if flag == 1:
print("No solution")
else:
res = list(s)
y = []
prev = 0
i = 0
aa = []
while i < len(res):
if res[i] == "@":
y.append(res[prev : i + 2])
aa.append("".join(y[-1]))
y.append(",")
prev = i + 2
i += 2
else:
i += 1
r = s[::-1]
for g in range(len(r)):
if r[g] == "@":
break
if g > 1:
aa.append(r[: g - 1][::-1])
for gg in aa[-1]:
aa[-2] += gg
aa.pop(-1)
fin = []
for i in range(len(aa)):
fin.append(aa[i])
if i != len(aa) - 1:
fin.append(",")
print("".join(fin))
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER NUMBER ASSIGN VAR NUMBER IF VAR NUMBER NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR STRING NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER FOR VAR VAR NUMBER VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
t = []
k = 0
y = 1
while 1:
a = s.find("@", k + 1)
if a < 0:
break
r = s[k : a + 2]
if r.count("@") == 0 or r[0] == "@" or r[-1] == "@":
y = 0
t += [r]
k = a + 2
if t and s[k:].count("@") == 0:
t[-1] += s[k:]
p = ""
for i in t:
p += i
print(["No solution", ",".join(t)][p == s and y])
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR FUNC_CALL VAR STRING BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR STRING NUMBER VAR NUMBER STRING VAR NUMBER STRING ASSIGN VAR NUMBER VAR LIST VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR FUNC_CALL VAR VAR STRING NUMBER VAR NUMBER VAR VAR ASSIGN VAR STRING FOR VAR VAR VAR VAR EXPR FUNC_CALL VAR LIST STRING FUNC_CALL STRING VAR VAR VAR VAR
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
def main():
s = input().split("@")
ans = ""
itr = 0
if len(s) < 2 or len(s[0]) < 1 or len(s[-1]) < 1:
print("No solution")
return
for i in range(1, len(s) - 1):
if len(s[i]) < 2:
print("No solution")
return
ans = s[0] + "@" + s[1][0]
for i in range(1, len(s) - 1):
ans += "," + s[i][1:] + "@" + s[i + 1][0]
ans += s[-1][1:]
print(ans)
main()
|
FUNC_DEF ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING RETURN FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR BIN_OP BIN_OP VAR NUMBER STRING VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER VAR BIN_OP BIN_OP BIN_OP STRING VAR VAR NUMBER STRING VAR BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
x = ""
c = True
if s[0] == "@" or s[len(s) - 1] == "@" or s.count("@") == 0:
print("No solution")
else:
i = 1
l = 0
m = s.split("@")
x += m[0]
while i < len(m):
if i == len(m) - 1:
x += "@" + m[i]
elif len(m[i]) < 2:
c = False
break
else:
x += "@" + m[i][: len(m[i]) - 1] + "," + m[i][len(m[i]) - 1 :]
i += 1
if c:
print(x)
else:
print("No solution")
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER IF VAR NUMBER STRING VAR BIN_OP FUNC_CALL VAR VAR NUMBER STRING FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING VAR VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR BIN_OP STRING VAR VAR IF FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR BIN_OP BIN_OP BIN_OP STRING VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER STRING VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER VAR NUMBER IF VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
prev = 0
lis = []
start = 0
flag = 0
for i in range(len(s)):
if s[i] == "@" and prev == 0:
if i - prev <= 0:
flag = 1
break
prev = i
elif s[i] == "@":
if i - prev > 2:
lis.append(s[start : prev + 2])
start = prev + 2
prev = i
else:
flag = 1
break
if flag:
print("No solution")
elif s[start] != "@" and "@" in s[start:] and s[len(s) - 1] != "@":
lis.append(s[start:])
for i in range(len(lis) - 1):
print(lis[i], end=",")
print(lis[len(lis) - 1])
else:
print("No solution")
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL VAR STRING IF VAR VAR STRING STRING VAR VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER STRING EXPR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR STRING EXPR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
t = 1
def goodIx(arr):
for i in range(1, len(arr)):
if arr[i] - arr[i - 1] == 1 or arr[i] - arr[i - 1] == 2:
return False
return True
while t > 0:
s = input()
ix = [i for i, ltr in enumerate(s) if ltr == "@"]
if 0 in ix or len(s) - 1 in ix or len(ix) == 0:
print("No solution")
elif not goodIx(ix):
print("No solution")
else:
res = []
for i in range(len(s)):
res.append(s[i])
if i - 1 in ix and not ix[-1] == i - 1:
res.append(",")
if res[-1] == ",":
res = res[: len(res) - 1]
print("".join(res))
t -= 1
|
ASSIGN VAR NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR BIN_OP VAR NUMBER NUMBER BIN_OP VAR VAR VAR BIN_OP VAR NUMBER NUMBER RETURN NUMBER RETURN NUMBER WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR VAR STRING IF NUMBER VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER VAR VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER STRING ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR VAR NUMBER
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
a, v = input().split("@"), []
if len(a) == 1 or not a[0] or not a[-1]:
print("No solution")
exit()
for i in range(1, len(a) - 1):
if len(a[i]) < 2:
print("No solution")
exit()
else:
v.append("{}@{}".format(a[i - 1], a[i][0]))
a[i] = a[i][1:]
v.append("{}@{}".format(a[-2], a[-1]))
print(",".join(v))
|
ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING LIST IF FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR BIN_OP VAR NUMBER VAR VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
line = input()
line = "#" + line + "#"
nAts = line.count("@")
ansLine = ""
nEmails = 0
atEncountered = 0
for i, char in enumerate(line):
if char != "#":
ansLine += char
if char == "@":
atEncountered += 1
if i > 0 and line[i - 1] == "@":
if (
line[i] != "@"
and line[i - 2] != "@"
and line[i] != "#"
and line[i - 2] != "#"
):
line = line[: i - 2] + "#" + "#" + "#" + line[i + 1 :]
nEmails += 1
if atEncountered < nAts:
ansLine += ","
else:
print("No solution")
quit()
if nEmails:
print(ansLine)
else:
print("No solution")
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP STRING VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR STRING VAR VAR IF VAR STRING VAR NUMBER IF VAR NUMBER VAR BIN_OP VAR NUMBER STRING IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR VAR STRING VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER STRING STRING STRING VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR VAR VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
if s.count("@") == 0:
print("No solution")
elif s[0] == "@" or s[-1] == "@":
print("No solution")
else:
cnt = s[:3].count("@")
f = 0
for i in range(3, len(s)):
if cnt >= 2:
f = 1
break
cnt += bool(s[i] == "@") - bool(s[i - 3] == "@")
if cnt >= 2:
f = 1
break
if f:
print("No solution")
elif s.count("@") == 1:
print(s)
else:
c = 0
for i in range(1, len(s) + 1):
if s[-i] == "@":
c += 1
if c == 2:
c = len(s) - i + 2
break
print(s[:3], end="")
for i in range(3, len(s)):
if i == c:
print(",", s[i:], sep="")
break
elif s[i - 2] == "@":
print(",", s[i], sep="", end="")
else:
print(s[i], end="")
|
ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER STRING VAR NUMBER STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR NUMBER STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR VAR STRING FUNC_CALL VAR VAR BIN_OP VAR NUMBER STRING IF VAR NUMBER ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL VAR STRING IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER STRING FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING VAR VAR STRING IF VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR STRING VAR VAR STRING STRING EXPR FUNC_CALL VAR VAR VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
a = list(s.split("@"))
ans = ""
for i in range(1, len(a) - 1):
if len(a[i]) <= 1:
print("No solution")
exit()
if len(a[0]) == 0 or len(a[len(a) - 1]) == 0 or "@" not in s:
print("No solution")
exit()
j = 0
for i in range(len(s)):
if s[i] == "@":
ans += s[j : i + 2] + ","
j = i + 2
ans = ans[: len(ans) - 1] + s[j:]
print(ans)
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR BIN_OP VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
a = input()
a = a + "1"
s = ""
l = 0
k = ""
if a[0] == "@" or a[-2] == "@":
print("No solution")
else:
for i in range(len(a)):
if a[i] == "@" and a[i + 2] == "@":
print("No solution")
l = 2
break
elif a[i] == "@" and a[i + 1] == "@":
print("No solution")
l = 2
break
if a[i] == "1":
k = k[:-1] + s
elif a[i] != "@" and a[i - 1] != "@":
s = s + a[i]
elif a[i] == "@":
l = 1
k = k + s + a[i] + a[i + 1] + ","
s = ""
if l == 1:
print(k)
elif l == 0:
print("No solution")
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR STRING IF VAR NUMBER STRING VAR NUMBER STRING EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER VAR IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR STRING ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
def main():
email = input()
if len(email) < 3 or email.count("@") == 0:
print("No solution")
return
if len(email) == 3:
if email.count("@") != 1 or email[1] != "@":
print("No solution")
return
pos = []
for i in range(0, len(email)):
if email[i] == "@":
pos.append(i)
if i == 0 or i == len(email) - 1:
print("No solution")
return
elif len(pos) >= 2:
if pos[-1] - pos[-2] <= 2:
print("No solution")
return
ans = []
temp = ""
atual = 2
i = 0
while i < len(email):
temp += email[i]
if email[i] == "@":
temp += email[i + 1]
ans.append(temp)
i += 1
temp = ""
i += 1
ans.append(temp)
if len(ans) >= 2:
if ans[-1].count("@") == 0:
ans[-2] += ans[-1]
del ans[-1]
print(",".join(ans))
main()
|
FUNC_DEF ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING RETURN IF FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR STRING NUMBER VAR NUMBER STRING EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR IF VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN IF FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR LIST ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR STRING VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR STRING VAR NUMBER EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR NUMBER STRING NUMBER VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
n = len(s)
ans = []
x = ""
c = 0
for i in range(n):
if i != n - 1:
if s[i + 1] != "@":
x = x + s[i]
elif c == 0:
x = x + s[i]
c = 1
else:
ans.append(x)
x = ""
x = x + s[i]
c = 1
else:
x = x + s[i]
ans.append(x)
f = 0
for i in range(len(ans)):
if ans[i][0] == "@" or ans[i][-1] == "@" or "@" not in ans[i]:
f = 1
break
if f:
print("No solution")
else:
for i in range(len(ans) - 1):
print(ans[i] + ",", end="")
print(ans[-1])
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER STRING VAR VAR NUMBER STRING STRING VAR VAR ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR STRING STRING EXPR FUNC_CALL VAR VAR NUMBER
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input().split("@")
n = len(s) - 1
for i in range(1, n):
if len(s[i]) < 2:
s = False
break
s[i] = s[i][0] + "," + s[i][1:]
if n > 0 and s and s[0] and s[n]:
print("@".join(s))
else:
print("No solution")
|
ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR BIN_OP BIN_OP VAR VAR NUMBER STRING VAR VAR NUMBER IF VAR NUMBER VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
k = input()
l = []
for i in range(len(k)):
if k[i] == "@":
l.append(i)
if 0 in l or len(k) - 1 in l:
print("No solution")
else:
flag = 0
for i in range(len(l) - 1):
if abs(l[i] - l[i + 1]) <= 2:
flag = 1
break
if flag == 0:
ans = k[0]
for i in range(1, len(k)):
if k[i - 1] == "@":
ans += k[i]
ans += ","
else:
ans += k[i]
u = ans.rfind(",")
ans = ans[:u] + ans[u + 1 :]
if ans.count("@") == 0:
print("No solution")
else:
print(ans)
else:
print("No solution")
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR IF NUMBER VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER STRING VAR VAR VAR VAR STRING VAR VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
l = len(s)
i = 0
t = ""
j = 0
lis = []
if len(s) <= 2:
print("No solution")
exit()
while i < l - 1:
if s[i] == "@":
t += "@" + s[i + 1]
i += 1
j = i
lis.append(t)
t = ""
else:
t += s[i]
i += 1
if len(lis) == 0:
print("No solution")
exit()
if j < len(s) - 1:
lis[-1] += s[j + 1 :]
for i in lis:
if i[0] == "@" or i[-1] == "@" or "@@" in i:
print("No solution")
break
else:
for i in lis[:-1]:
print(i, end=",")
print(lis[-1])
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR LIST IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR WHILE VAR BIN_OP VAR NUMBER IF VAR VAR STRING VAR BIN_OP STRING VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR VAR VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER FOR VAR VAR IF VAR NUMBER STRING VAR NUMBER STRING STRING VAR EXPR FUNC_CALL VAR STRING FOR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR VAR NUMBER
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
data = input().split("@")
if len(data) == 1 or len(data[0]) == 0 or len(data[-1]) == 0:
print("No solution")
exit(0)
for chunk in data[1:-1]:
if len(chunk) < 2:
print("No solution")
exit(0)
if len(data) == 2:
print(data[0] + "@" + data[1])
exit(0)
ans = [(data[i][1:] + "@" + data[i + 1][0]) for i in range(1, len(data) - 2)]
ans.insert(0, data[0] + "@" + data[1][0])
ans.append(data[-2][1:] + "@" + data[-1])
print(",".join(ans))
|
ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER FOR VAR VAR NUMBER NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER STRING VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER STRING VAR BIN_OP VAR NUMBER NUMBER VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR NUMBER STRING VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER STRING VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
if s.count("@") == 0 or s[0] == "@" or s[-1] == "@":
print("No solution")
exit()
a = []
x = ""
n = 0
for i in range(len(s)):
x += s[i]
if n == 1:
x += ","
if s[i] == "@":
n = 1
else:
n = 0
a = " ".join(x.split(",")).split()
for i in range(len(a)):
if "@" not in a[i]:
a[i - 1] += a[i]
a[i] = ""
elif a[i][0] == "@" or a[i][-1] == "@":
print("No solution")
exit()
print(",".join(a).rstrip(","))
|
ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR STRING NUMBER VAR NUMBER STRING VAR NUMBER STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR NUMBER VAR STRING IF VAR VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL STRING FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF STRING VAR VAR VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR VAR STRING IF VAR VAR NUMBER STRING VAR VAR NUMBER STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL FUNC_CALL STRING VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
from sys import exit, stdin, stdout
addresses = stdin.readline().strip()
if addresses[0] == "@" or addresses[-1] == "@" or addresses.find("@") == -1:
print("No solution")
exit(0)
splits = addresses.split("@")
solution = ""
for split in splits[1:-1]:
split_len = len(split)
if split_len == 0 or split_len == 1:
print("No solution")
exit(0)
solution += "@" + split[0] + "," + split[1:]
if len(splits) == 2:
stdout.write(addresses)
else:
stdout.write("{}@{}@{}\n".format(splits[0], solution[1:], splits[-1]))
|
ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING VAR NUMBER STRING FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR STRING FOR VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER VAR BIN_OP BIN_OP BIN_OP STRING VAR NUMBER STRING VAR NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR NUMBER VAR NUMBER VAR NUMBER
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
a = input()
lista = []
for i in range(0, len(a)):
if a[i] == "@":
lista.append(i)
d = 0
cadena = ""
contador = 0
boleano = True
if len(lista) >= 1:
b = int(lista[contador]) + 2
if int(lista[0]) == 0 or len(a) == 2 or a[-1] == "@":
print("No solution")
else:
if len(lista) % 2 == 0:
n = 2
m = 1
else:
n = 1
m = 1
for j in range(0, len(lista) - m):
if (
int(lista[j]) - int(lista[j + 1]) == -1
or int(lista[j]) - int(lista[j + 1]) == -2
):
print("No solution")
boleano = 1 == 2
break
if boleano:
for t in range(0, len(lista)):
if t == len(lista) - 1:
b = len(a)
for k in range(d, b):
cadena += a[k]
if len(lista) - 1 != t:
cadena = cadena + ","
d = int(lista[t]) + 2
if t == len(lista) - 1:
t = t - 1
b = b + 2
b = int(lista[t + 1]) + 2
print(cadena)
contador = 0
elif len(lista) == len(a) or len(lista) == 0:
print("No solution")
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER VAR NUMBER STRING EXPR FUNC_CALL VAR STRING IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER NUMBER IF VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER VAR ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
def s():
a = input()
if a[0] == "@" or a[-1] == "@":
return False
a = a.split("@")
if len(a) == 2:
print(*a, sep="@")
return True
if len(a) == 1 or min(list(len(i) for i in a[1:-1])) < 2:
return False
print(a[0], end="")
for i in a[1:-1]:
print("@", i[0], ",", i[1:], sep="", end="")
print("@", a[-1], sep="")
return True
print("" if s() else "No solution")
|
FUNC_DEF ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER STRING VAR NUMBER STRING RETURN NUMBER ASSIGN VAR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR STRING RETURN NUMBER IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR NUMBER NUMBER NUMBER RETURN NUMBER EXPR FUNC_CALL VAR VAR NUMBER STRING FOR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING VAR NUMBER STRING VAR NUMBER STRING STRING EXPR FUNC_CALL VAR STRING VAR NUMBER STRING RETURN NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR STRING STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
strings, found = input().split("@"), False
if len(strings[0]) == 0 or len(strings[-1]) == 0 or len(strings) == 1:
found = True
for i in range(1, len(strings) - 1):
if len(strings[i]) < 2:
found = True
else:
strings[i] = strings[i][0] + "," + strings[i][1:]
if not found:
print("@".join(strings))
else:
print("No solution")
|
ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING NUMBER IF FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR BIN_OP BIN_OP VAR VAR NUMBER STRING VAR VAR NUMBER IF VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
from sys import stdout
a = input()
c = list(a.split("@"))
while "" in c:
c.remove("")
if a.count("@") == 0:
exit(print("No solution"))
if a.count("@") != len(c) - 1:
exit(print("No solution"))
if any(len(i) == 1 for i in c[1 : len(c) - 1]):
exit(print("No solution"))
stdout.write(c[0] + "@")
for i in range(1, len(c) - 1):
stdout.write(c[i][: len(c[i]) // 2] + "," + c[i][len(c[i]) // 2 :] + "@")
stdout.write(c[-1])
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING WHILE STRING VAR EXPR FUNC_CALL VAR STRING IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR STRING IF FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR STRING IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER STRING VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER STRING EXPR FUNC_CALL VAR VAR NUMBER
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
ind = 0
l = []
r = ""
if "@" in s and len(s) > 2 and s[-1] != "@":
for i in range(len(s)):
if s[i] == "@":
if ind == i or s[i + 1] == "@":
r = "No solution"
break
else:
if "@" in s[i + 2 : len(s)]:
l.append(s[ind : i + 2])
else:
l.append(s[ind : len(s)])
break
ind = i + 2
else:
r = "No solution"
if r == "No solution":
print(r)
else:
print(l[0], end="")
for i in range(1, len(l)):
print(",{}".format(l[i]), end="")
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR STRING IF STRING VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR STRING IF STRING VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR STRING IF VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR NUMBER STRING FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
a = input().split("@")
n = len(a)
b = []
if n >= 2:
for i in range(n):
if len(a[i]) > int(i != 0 and i != n - 1):
if i != 0 and i != n - 1:
b.append(a[i - 1][min(1, i - 1) :] + "@" + a[i][0])
elif i == n - 1:
b.append(a[i - 1][min(1, i - 1) :] + "@" + a[i])
else:
print("No solution")
break
else:
c = b[0]
for i in range(1, len(b)):
c += "," + b[i]
print(c)
else:
print("No solution")
|
ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST IF VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR NUMBER VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER STRING VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER STRING VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR BIN_OP STRING VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
s = input()
n = len(s)
ans = []
nosol = False
for i in range(n):
if s[i] == "@":
ans.append(i)
for i in range(1, len(ans)):
if ans[i] - ans[i - 1] > 2:
pass
else:
nosol = True
break
if s[0] == "@" or s[-1] == "@":
nosol = True
if len(ans) == 0:
nosol = True
if nosol == False:
result = ""
last = ans[-1]
for i in range(n):
if i - 1 in ans and i - 1 != last:
result += s[i]
result += ","
else:
result += s[i]
print(result)
else:
print("No solution")
|
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER IF VAR NUMBER STRING VAR NUMBER STRING ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR STRING ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR VAR VAR VAR STRING VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
a = input().split("@")
ans = a[0]
if len(a[0]) == 0 or len(a) <= 1 or len(a[-1]) == 0:
print("No solution")
exit()
for u in range(1, len(a) - 1):
if len(a[u]) > 1:
ans += "@" + a[u][0] + "," + a[u][1:]
else:
print("No solution")
exit()
print(ans + "@" + a[-1])
|
ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR NUMBER VAR BIN_OP BIN_OP BIN_OP STRING VAR VAR NUMBER STRING VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR STRING VAR NUMBER
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
import sys
def fail():
print("No solution")
sys.exit()
result = []
s = input().strip()
if "@" not in s:
fail()
n = len(s)
start = 0
pos = 0
while True:
while pos < n and s[pos] != "@":
pos += 1
if pos == n:
result[-1] += s[start:]
break
if pos == start or pos + 1 == n or s[pos + 1] == "@":
fail()
result.append(s[start : pos + 2])
start = pos + 2
pos = start
print(",".join(result))
|
IMPORT FUNC_DEF EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER WHILE VAR VAR VAR VAR STRING VAR NUMBER IF VAR VAR VAR NUMBER VAR VAR IF VAR VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR
|
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
Input
The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
Output
If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
|
from sys import stdin, stdout
def cf31B():
from sys import stdin, stdout
inp = list(stdin.readline().strip().split("@"))
flag = True
if len(inp) >= 2:
if len(inp[0]) == 0 or len(inp[-1]) == 0:
flag = False
if flag:
for i in range(1, len(inp) - 1):
if len(inp[i]) < 2:
flag = False
break
else:
flag = False
answer = ""
if flag:
for i, j in enumerate(inp):
if i == 0:
answer += j
elif i == len(inp) - 1:
answer += "@" + j
else:
answer += "@" + j[:-1] + "," + j[-1]
else:
answer = "No solution"
stdout.write(answer + "\n")
cf31B()
|
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER IF VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING IF VAR FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR BIN_OP STRING VAR VAR BIN_OP BIN_OP BIN_OP STRING VAR NUMBER STRING VAR NUMBER ASSIGN VAR STRING EXPR FUNC_CALL VAR BIN_OP VAR STRING EXPR FUNC_CALL VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
__T = int(input())
for _ in range(__T):
n = int(input())
k = n // 2
if n == 1:
print("a")
elif n % 2 == 0:
print("a" * k + "b" + "a" * (k - 1))
else:
print("a" * k + "bc" + "a" * (k - 1))
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING VAR STRING BIN_OP STRING BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING VAR STRING BIN_OP STRING BIN_OP VAR NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for _ in range(int(input())):
x = int(input())
if x == 1:
print("a")
elif x % 2 == 0:
print("a" * (x // 2) + "b" + "a" * (x // 2 - 1))
else:
print("a" * (x // 2) + "b" + "a" * (x // 2 - 1) + "c")
|
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER STRING
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for _ in range(int(input())):
n = int(input())
if n == 1:
print("a")
else:
check = True
if (n - 1) % 2 == 0:
check = False
q = (n - 2) // 2
s = "a" * q
s += "b"
w = "a" * (q + 1)
if check == False:
s += "c"
s += w
print(s)
|
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP STRING VAR VAR STRING ASSIGN VAR BIN_OP STRING BIN_OP VAR NUMBER IF VAR NUMBER VAR STRING VAR VAR EXPR FUNC_CALL VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
def sol():
n = int(input())
if n == 1:
print("x")
elif n % 2:
print("x" * (n // 2) + "yz" + "x" * (n // 2 - 1))
else:
print("x" * (n // 2) + "y" + "x" * (n // 2 - 1))
t = int(input())
for i in range(t):
sol()
|
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for _ in range(int(input())):
n = int(input())
ans = ""
if n % 2 == 1:
ans += "c"
n -= 1
ans += "a" * (n // 2)
ans += "b"
ans += "a" * (n // 2 - 1)
if n == 0:
print("a")
continue
print(ans)
|
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING IF BIN_OP VAR NUMBER NUMBER VAR STRING VAR NUMBER VAR BIN_OP STRING BIN_OP VAR NUMBER VAR STRING VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
import sys
input = sys.stdin.readline
t = int(input())
for j in range(t):
n = int(input())
ans = []
if n == 2:
print("ab")
continue
if n % 2 == 0:
ans1 = []
for i in range(n // 2):
ans1.append("a")
ans.extend(ans1)
ans.append("b")
ans.extend(ans1)
ans.pop(n - 1)
else:
n = n - 1
ans1 = []
for i in range(n // 2):
ans1.append("a")
ans.extend(ans1)
ans.append("b")
ans.extend(ans1)
ans.pop(-1)
ans.extend("c")
print("".join(ans))
|
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
T = int(input())
for t in range(T):
n = int(input())
x = n // 2
print("a" * x + "bc"[: n - x - max(0, x - 1)] + "a" * max(0, x - 1))
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING VAR STRING BIN_OP BIN_OP VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER BIN_OP STRING FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
import sys
def rl():
return sys.stdin.readline().strip()
def rl_types(types):
str_list = [x for x in sys.stdin.readline().strip().split(" ")]
return [types[i](str_list[i]) for i in range(len(str_list))]
def pr(something):
sys.stdout.write(str(something) + "\n")
def pra(array):
sys.stdout.write(" ".join([str(x) for x in array]) + "\n")
def solve(array):
return array
NT = int(rl())
for _ in range(NT):
n = int(rl())
if n < 4:
pr("".join([chr(ord("a") + c) for c in range(n)]))
continue
sm = n // 2
if n % 2 == 0:
s = "a" * (sm - 1) + "b" + "a" * sm
else:
s = "a" * (sm - 1) + "bc" + "a" * sm
pr(s)
|
IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING RETURN FUNC_CALL VAR VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING FUNC_DEF EXPR FUNC_CALL VAR BIN_OP FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR STRING FUNC_DEF RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING VAR EXPR FUNC_CALL VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
t = int(input())
for i in [0] * t:
n = int(input())
if n % 2:
print("c" * int(n > 1) + "a" * (n // 2 - 1) + "b" + "a" * (n // 2))
else:
print("a" * (n // 2 - 1) + "b" + "a" * (n // 2))
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP STRING FUNC_CALL VAR VAR NUMBER BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER STRING BIN_OP STRING BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER STRING BIN_OP STRING BIN_OP VAR NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for _ in range(int(input())):
n = int(input())
if n == 1:
print("a")
elif n % 2 == 0:
m = "a" * ((n - 2) // 2)
print(f"a{m}b{m}")
else:
m = "a" * ((n - 3) // 2)
print(f"a{m}bc{m}")
|
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING VAR STRING VAR ASSIGN VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING VAR STRING VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
t = int(input())
for tc in range(t):
n = int(input())
if n == 1:
print("a")
continue
m = n // 2
res = []
for i in range(m):
res.append("a")
res.append("y")
if n % 2:
res.append("x")
for i in range(m - 1):
res.append("a")
print("".join(res))
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
from sys import stdin
input = stdin.buffer.readline
def func():
if n == 1:
print("a")
else:
s = "a" * (n // 2)
if n & 1:
s += "bc"
else:
s += "b"
s += "a" * (n // 2 - 1)
print(s)
for _ in range(int(input())):
n = int(input())
func()
|
ASSIGN VAR VAR FUNC_DEF IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP STRING BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER VAR STRING VAR STRING VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
t = int(input())
while t:
n = int(input())
s = ""
if n == 1:
print("a")
t -= 1
continue
if n % 2 == 0:
s += int(n / 2) * "a" + "b" + int(n / 2 - 1) * "a"
else:
s += int(n / 2) * "a" + "bc" + int(n / 2 - 1) * "a"
print(s)
t -= 1
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER STRING STRING BIN_OP FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER STRING VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER STRING STRING BIN_OP FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER STRING EXPR FUNC_CALL VAR VAR VAR NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for i in " " * int(input()):
n = int(input())
c = n % 2
n = n - n % 2
print("a" * (n // 2) + "b" * [0, 1][n > 0] + "a" * (n // 2 - 1) + "c" * c)
|
FOR VAR BIN_OP STRING FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER BIN_OP STRING LIST NUMBER NUMBER VAR NUMBER BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP STRING VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
import sys
from sys import stdin
tt = int(stdin.readline())
for loop in range(tt):
n = int(stdin.readline())
if n == 1:
print("a")
elif n % 2 == 0:
fi = n // 2
sc = n // 2 - 1
a = ["a"] * fi
a.append("b")
for j in range(sc):
a.append("a")
print("".join(a))
else:
fi = n // 2
sc = n // 2 - 1
a = ["a"] * fi
a.append("b")
a.append("c")
for j in range(sc):
a.append("a")
print("".join(a))
|
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST STRING VAR EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for _ in range(int(input())):
n = int(input())
if n == 1:
print("a")
elif n == 2:
print("ab")
elif n % 2 == 0:
xx = n // 2
print("a" * xx + "b" + "a" * (xx - 1))
else:
n -= 1
xx = n // 2
print("a" * xx + "b" + "a" * (xx - 1) + "c")
|
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING VAR STRING BIN_OP STRING BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP STRING VAR STRING BIN_OP STRING BIN_OP VAR NUMBER STRING
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
def solve(n, i):
if n <= 6:
res = ""
for j in range(n):
res += chr(i + j + ord("a"))
return res
a = chr(i + ord("a"))
b = chr(i + 1 + ord("a"))
if n % 3 == 0:
c = a + a + b
d = b + b + a
s = solve((n - 6) // 3, i + 2)
return "".join([s, c, s, d, s])
elif n % 3 == 1:
c = a + a + a + b + b
d = b + b + b + a + a
if n > 10:
s = solve((n - 10) // 3, i + 2)
return "".join([s, c, s, d, s])
else:
s = solve(n - 1, i + 1)
return "".join([s, a])
else:
s = solve((n - 2) // 3, i + 2)
return "".join([s, a, s, b, s])
def main():
t = int(input())
for _ in range(t):
n = int(input())
print(solve(n, 0))
main()
|
FUNC_DEF IF VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR FUNC_CALL VAR STRING RETURN VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER RETURN FUNC_CALL STRING LIST VAR VAR VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER RETURN FUNC_CALL STRING LIST VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER RETURN FUNC_CALL STRING LIST VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER RETURN FUNC_CALL STRING LIST VAR VAR VAR VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for t in range(int(input())):
n = int(input())
if n == 1:
print("a")
continue
elif n == 2:
print("ab")
continue
half = n // 2
if n % 2:
print("a" * (half - 1) + "b" + "a" * half + "c")
else:
print("a" * (half - 1) + "b" + "a" * half)
|
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
t = int(input())
for _ in range(t):
n = int(input())
if n == 1:
print("a")
elif n == 2:
print("ab")
elif n == 3:
print("abc")
elif n % 2 == 0:
print("a" * (n // 2) + "b" + "a" * (n // 2 - 1))
else:
print("a" * (n // 2) + "bc" + "a" * (n // 2 - 1))
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
import sys
input = sys.stdin.readline
def main():
t = int(input())
for _ in range(t):
n = int(input())
top = []
if n == 1:
print("a")
continue
if n == 2:
print("ab")
continue
if n == 3:
print("abc")
continue
if n % 2 == 0:
k = n // 2
for _ in range(k - 1):
top.append("a")
top.append("c")
for _ in range(k):
top.append("a")
else:
k = (n - 2) // 2
for _ in range(k - 1):
top.append("a")
top.append("c")
top.append("b")
for _ in range(k):
top.append("a")
top.append("b")
top.append("b")
print("".join(top))
main()
|
IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for _ in range(int(input())):
n = int(input())
if n <= 26:
print("abcdefghijklmnopqrstuvwxyz"[:n])
continue
x = n - 1 - (n % 2 == 1)
print("a" * (x // 2) + "bc"[: 1 + n % 2] + "a" * (x // 2 + 1))
|
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for _ in range(int(input())):
n = int(input())
if n <= 5:
print("abcde"[:n])
else:
print("a" * (n // 2 - 1) + "bc"[: 1 + n % 2] + "a" * (n // 2))
|
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER STRING BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP STRING BIN_OP VAR NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for _ in range(int(input())):
n = int(input())
if n == 1:
print("a")
elif n % 2:
print("a" * (n // 2 - 1) + "b" + "a" * (n // 2) + "c")
else:
print("a" * (n // 2 - 1) + "b" + "a" * (n // 2))
|
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER STRING BIN_OP STRING BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER STRING BIN_OP STRING BIN_OP VAR NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
def shift(s, start):
return "".join([chr(ord(c) + start) for c in s])
def ans(n, start):
if n == 0:
return ""
if n == 1:
return shift("a", start)
elif n == 2:
return shift("ab", start)
elif n == 3:
return shift("abc", start)
elif n == 4:
return shift("abaa", start)
elif n == 6:
return shift("bacada", start)
elif n == 7:
return shift("bacadae", start)
elif n == 10:
return shift("bacadaeafa", start)
elif n % 3 == 0:
sub = ans(n // 3 - 2, start + 2)
return sub + shift("abb", start) + sub + shift("baa", start) + sub
elif n % 3 == 1:
sub = ans(n // 3 - 3, start + 2)
return sub + shift("aabbb", start) + sub + shift("bbaaa", start) + sub
else:
sub = ans(n // 3, start + 2)
return sub + shift("a", start) + sub + shift("b", start) + sub
t = int(input())
for i in range(t):
n = int(input())
print(ans(n, 0))
|
FUNC_DEF RETURN FUNC_CALL STRING FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR VAR VAR FUNC_DEF IF VAR NUMBER RETURN STRING IF VAR NUMBER RETURN FUNC_CALL VAR STRING VAR IF VAR NUMBER RETURN FUNC_CALL VAR STRING VAR IF VAR NUMBER RETURN FUNC_CALL VAR STRING VAR IF VAR NUMBER RETURN FUNC_CALL VAR STRING VAR IF VAR NUMBER RETURN FUNC_CALL VAR STRING VAR IF VAR NUMBER RETURN FUNC_CALL VAR STRING VAR IF VAR NUMBER RETURN FUNC_CALL VAR STRING VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER RETURN BIN_OP BIN_OP BIN_OP BIN_OP VAR FUNC_CALL VAR STRING VAR VAR FUNC_CALL VAR STRING VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER RETURN BIN_OP BIN_OP BIN_OP BIN_OP VAR FUNC_CALL VAR STRING VAR VAR FUNC_CALL VAR STRING VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER RETURN BIN_OP BIN_OP BIN_OP BIN_OP VAR FUNC_CALL VAR STRING VAR VAR FUNC_CALL VAR STRING VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
te = int(input())
while te:
te -= 1
t = int(input())
s = "abcdefghijklmnopqrstuvwxyz"
if t <= 26:
print(s[:t])
else:
ans = "a" * (t // 2) + "b" + "a" * (t // 2 - 1)
ans = ans + "c" * (t % 2)
print(ans)
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR BIN_OP STRING BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for _ in range(int(input())):
n = int(input())
print(
"a" * (n // 2) + "b" + "a" * max(0, n // 2 - 1)
if n % 2 == 0 or n == 1
else "a" * (n // 2) + "bc" + "a" * (n // 2 - 1)
)
|
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
n = int(input())
for i in range(n):
a = int(input())
if a == 1:
print("a")
elif a % 2 == 0:
print("a" * (a // 2), end="")
print("b", end="")
print("a" * (a - (a // 2 + 1)))
else:
print("a" * ((a - 1) // 2), end="")
print("b", end="")
print("a" * (a - 1 - (a // 2 + 1)), end="")
print("c")
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP STRING BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR STRING STRING EXPR FUNC_CALL VAR BIN_OP STRING BIN_OP VAR BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER STRING EXPR FUNC_CALL VAR STRING STRING EXPR FUNC_CALL VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER STRING EXPR FUNC_CALL VAR STRING
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
import sys
LI = lambda: list(map(int, sys.stdin.readline().split()))
MI = lambda: map(int, sys.stdin.readline().split())
SI = lambda: sys.stdin.readline().strip("\n")
II = lambda: int(sys.stdin.readline())
for _ in range(II()):
n = II()
if n == 1:
print("a")
continue
if n % 2:
n -= 1
s = "h" * max(0, n // 2) + "us" + "h" * max(0, n // 2 - 1)
else:
s = "h" * max(0, n // 2) + "u" + "h" * max(0, n // 2 - 1)
print(s)
|
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER STRING BIN_OP STRING FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER STRING BIN_OP STRING FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
t = int(input())
while t > 0:
n = int(input())
ans = "a" * int(n / 2) + "b" + "a" * int(n / 2 - 1)
if n % 2 == 1:
ans += "c"
if n == 1:
ans = "a"
print(ans)
t -= 1
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING FUNC_CALL VAR BIN_OP VAR NUMBER STRING BIN_OP STRING FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER VAR STRING IF VAR NUMBER ASSIGN VAR STRING EXPR FUNC_CALL VAR VAR VAR NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
from sys import *
ws = lambda: map(int, stdin.readline().strip().split())
li = lambda: list(map(int, stdin.readline().strip().split()))
mod = 1000000007
def ncr(n, r, p):
num = den = 1
for i in range(r):
num = num * (n - i) % p
den = den * (i + 1) % p
return num * pow(den, p - 2, p) % p
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def prod(l):
ans = 1
for i in range(len(l)):
ans = ans * l[i]
return ans
def sortindex(l, a):
c = []
if a == -1:
rev = True
else:
rev = False
for i in range(len(l)):
c.append([l[i], i])
x = sorted(c, reverse=rev)
print(x)
c = []
for i in range(len(l)):
c.append(x[i][1])
return c
for _ in range(int(input())):
n = int(input())
if n == 1:
print("z")
continue
if n & 1:
t1 = n // 2
t2 = "a" * t1
t2 += "bc"
t2 += "a" * (t1 - 1)
print(t2)
else:
t1 = n // 2
t2 = "a" * t1
t2 += "b"
t2 += "a" * (t1 - 1)
print(t2)
|
ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR RETURN BIN_OP BIN_OP VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR LIST IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP STRING VAR VAR STRING VAR BIN_OP STRING BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP STRING VAR VAR STRING VAR BIN_OP STRING BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for _ in range(int(input())):
n = int(input())
print(
"a"
if n == 1
else "a" * (n // 2) + ("bc" if n % 2 else "b") + "a" * (n // 2 - 1)
)
|
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR NUMBER STRING BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER BIN_OP VAR NUMBER STRING STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
t = int(input())
for _ in range(t):
n = int(input())
if n == 1:
print("a")
else:
lhs = "a" * (n // 2)
pivot = "b" * (n % 2)
lead = "c"
rhs = "a" * (n // 2 - 1)
print(lhs + pivot + lead + rhs)
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP STRING BIN_OP VAR NUMBER ASSIGN VAR BIN_OP STRING BIN_OP VAR NUMBER ASSIGN VAR STRING ASSIGN VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
te = int(input())
while te:
te -= 1
t = int(input())
s = "abcdefghijklmnopqrstuvwxyz"
if t <= 26:
print(s[:t])
elif t % 2 == 0:
print("a" * (t // 2) + "b" + "a" * (t // 2 - 1))
else:
print("a" * ((t - 1) // 2) + "b" + "a" * ((t - 1) // 2 - 1) + "c")
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER STRING BIN_OP STRING BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER STRING
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
n = int(input())
if n == 1:
ans = "a"
elif n % 2 == 0:
k = n // 2
ans = "a" * k + "b" + "a" * (k - 1)
else:
k = (n - 1) // 2
ans = "a" * k + "bc" + "a" * (k - 1)
print(ans)
|
IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR STRING IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING VAR STRING BIN_OP STRING BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING VAR STRING BIN_OP STRING BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
def rl():
return [int(w) for w in input().split()]
for _ in range(int(input())):
n = rl()[0]
if n == 1:
print("a")
elif n == 2:
print("ab")
elif n == 3:
print("abc")
elif n % 2 == 0:
k = (n - 1) // 2 + 1
print("a" * k + "b" + "a" * (k - 1))
elif n % 2 == 1:
k = (n - 2) // 2 + 1
print("a" * k + "bx" + "a" * (k - 1))
|
FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING VAR STRING BIN_OP STRING BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING VAR STRING BIN_OP STRING BIN_OP VAR NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
import sys
alp = "abcdefghijklmnopqrstuvwxyz"
for i in range(int(input())):
n = int(sys.stdin.readline())
if n < 20:
print(alp[0:n])
else:
if n % 2 == 1:
ans = "a" * (n // 2) + "b" + "a" * (n // 2 - 1) + "c"
else:
ans = "a" * (n // 2) + "b" + "a" * (n // 2 - 1)
print(ans)
|
IMPORT ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER STRING ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
n = int(input())
ext = n % 2 + 1
lw = (n - ext) // 2
if n < 5:
print("abcde"[:n])
continue
print("a" * lw + "bc"[:ext] + "a" * (lw + 1))
|
ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING VAR STRING VAR BIN_OP STRING BIN_OP VAR NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
from sys import stdin
input = stdin.readline
MX = int(200000.0 + 5)
MOD = int(1000000000.0 + 7)
def main():
test = int(input())
for _ in range(test):
n = int(input())
if n == 1:
ans = "a"
else:
m = n // 2
ans = "a" * m
ans += "b"
ans += "a" * (m - 1)
if n % 2 == 1:
ans += "c"
print(ans)
main()
|
ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP STRING VAR VAR STRING VAR BIN_OP STRING BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
def solve(n):
if n == 1:
print("a")
return
print("a" * (n // 2) + "b" + "a" * (n // 2 - 1) + "c" * (n % 2))
return
for _ in range(int(input())):
solve(int(input()))
|
FUNC_DEF IF VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP STRING BIN_OP VAR NUMBER RETURN FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
t = int(input())
def oddStr():
n = int(input())
if n > 1:
s = "a" * int(n / 2)
s += "b"
s += "a" * (int(n / 2) - 1)
if n % 2 != 0:
s += "c"
else:
s = "a"
print(s)
for i in range(t):
oddStr()
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR BIN_OP STRING FUNC_CALL VAR BIN_OP VAR NUMBER VAR STRING VAR BIN_OP STRING BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER VAR STRING ASSIGN VAR STRING EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
t = int(input())
for _ in range(t):
s = int(input())
if s % 2 == 0:
n = (s - 2) // 2
ans = "b" * n + "a" + "b" * (n + 1)
elif s == 1:
ans = "a"
else:
n = (s - 3) // 2
ans = "b" * n + "a" + "c" + "b" * (n + 1)
print(ans)
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING VAR STRING BIN_OP STRING BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP STRING VAR STRING STRING BIN_OP STRING BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
import sys
input = sys.stdin.buffer.readline
def solve_tc():
n = int(input())
if n & 1:
if n == 1:
return "b"
return "x" * (n // 2) + "ui" + "x" * (n // 2 - 1)
else:
return "x" * (n // 2) + "i" + "x" * (n // 2 - 1)
t = int(input())
for _ in range(t):
sys.stdout.write(str(solve_tc()) + "\n")
|
IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP VAR NUMBER IF VAR NUMBER RETURN STRING RETURN BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER RETURN BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR STRING
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
t = int(input())
for laskjkljfsd in range(t):
n = int(input())
if n % 2:
if n == 1:
print("a")
else:
print("a" * (n // 2) + "bc" + "a" * (n // 2 - 1))
else:
print("a" * (n // 2) + "b" + "a" * (n // 2 - 1))
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for _ in range(int(input())):
n = int(input())
if n == 1:
print("a")
else:
k = n // 2
print("a" * k + "b" + "a" * (k - 1) + ("c" if n % 2 != 0 else ""))
|
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP STRING VAR STRING BIN_OP STRING BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER STRING STRING
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
T = int(input())
for _ in range(T):
n = int(input())
if n == 1:
print("a")
elif n % 2 == 0:
x = n // 2
ans = ["a"] * x + ["b"] + ["a"] * (x - 1)
print(*ans, sep="")
else:
x = n // 2
ans = ["a"] * x + ["b", "c"] + ["a"] * (x - 1)
print(*ans, sep="")
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP LIST STRING VAR LIST STRING BIN_OP LIST STRING BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP LIST STRING VAR LIST STRING STRING BIN_OP LIST STRING BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR STRING
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
t = int(input())
for _ in range(t):
n = int(input())
if n == 1:
print("a")
continue
ans = "a" * (n // 2)
if n % 2 == 1:
ans += "bc"
else:
ans += "b"
ans += "a" * (n // 2 - 1)
print(ans)
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP STRING BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR STRING VAR STRING VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
import sys
input = sys.stdin.readline
t = int(input())
while t > 0:
n = int(input())
if n == 1:
s = "a"
else:
s = "a" * (n // 2)
if n % 2 != 0:
s += "bc"
else:
s += "b"
s += "a" * (n // 2 - 1)
print(s)
t -= 1
|
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR STRING ASSIGN VAR BIN_OP STRING BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR STRING VAR STRING VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for _ in range(int(input())):
n = int(input())
s = "abcdefghijklmnopqrstuvwxyz"
if n < 27:
print(s[:n])
else:
if n % 2 == 0:
k = n // 2
ans = ""
for i in range(n):
if i == k:
ans = ans + "a"
else:
ans = ans + "z"
else:
k = (n - 3) // 2
ans = "z" * k
ans = ans + "aaba"
a = "z" * (k - 1)
ans = ans + a
print(ans)
|
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP STRING VAR ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP STRING BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
from sys import stdin
input = stdin.readline
def answer():
ans, x = "", n // 2
if n & 1 == 0:
ans = "a" * x + "b" + "a" * (x - 1)
else:
if n == 1:
return "a"
ans = "a" * x + "b" + "c" + "a" * (x - 1)
return ans
for T in range(int(input())):
n = int(input())
print(answer())
|
ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR STRING BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING VAR STRING BIN_OP STRING BIN_OP VAR NUMBER IF VAR NUMBER RETURN STRING ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP STRING VAR STRING STRING BIN_OP STRING BIN_OP VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
t = int(input())
for i in range(t):
y = ""
n = int(input())
if n == 1:
print("a")
elif n == 2:
print("ab")
else:
if n % 2 != 0:
for i in range(n - 1):
if i == n // 2:
y = y + "bc"
else:
y = y + "a"
else:
for i in range(n):
if i == n // 2:
y = y + "b"
else:
y = y + "a"
print(y)
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR STRING EXPR FUNC_CALL VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
T = int(input())
for _ in range(T):
n = int(input())
A = []
if n == 1:
print("a")
continue
A.append("a" * (n // 2))
if n % 2 == 0:
A.append("b")
else:
A.append("bc")
A.append("a" * (n // 2 - 1))
print("".join(A))
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP STRING BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
T = int(input())
for t in range(T):
N = int(input())
ans = "a" * (N // 2) + "b" + "a" * (N // 2 - 1)
if N & 1 and N != 1:
ans += "c"
print(ans)
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR NUMBER VAR NUMBER VAR STRING EXPR FUNC_CALL VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
import sys
tokens = "".join(sys.stdin.readlines()).split()[::-1]
def next():
return tokens.pop()
def nextInt():
return int(next())
def nextFloat():
return float(next())
def getIntArray(n):
return [nextInt() for _ in range(n)]
def getFloatArray(n):
return [nextFloat() for _ in range(n)]
def getStringArray(n):
return [next() for _ in range(n)]
flush = sys.stdout.flush
testcase = True
def solve(testcase):
N = nextInt()
if N == 1:
print("q")
return
half = "s" * (N - 2 >> 1)
mid = "xy" if N % 2 else "z"
print(half + mid + half + "s")
testcaseCount = nextInt() if testcase else 1
for tc in range(testcaseCount):
solve(tc + 1)
assert not tokens
|
IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL STRING FUNC_CALL VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER STRING STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR STRING ASSIGN VAR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
def TestCase():
n = int(input())
if n == 1:
print("a")
else:
s = "a" * (n // 2)
if n & 1:
s += "bc"
else:
s += "b"
s += "a" * (n // 2 - 1)
print(s)
t = int(input())
for _ in range(t):
TestCase()
|
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP STRING BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER VAR STRING VAR STRING VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
for _ in range(int(input())):
n = int(input())
if n < 26:
ans = ""
for i in range(n):
ans += chr(ord("a") + i)
elif n % 2 == 0:
ans = "a" * (n // 2) + "b" + "a" * (n // 2 - 1)
else:
ans = "a" * (n // 2 - 1) + "b" + "a" * (n // 2 - 2) + "cde"
print(ans)
|
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER STRING EXPR FUNC_CALL VAR VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
z = "".join(chr(x) for x in range(ord("a"), ord("z") + 1))
for _ in range(int(input())):
n = int(input())
if n <= 26:
print(z[:n])
elif n % 2 == 0:
m = "a" * ((n - 12) // 2)
print(f"a{m}bcdaa{m}ddccbb")
else:
m = "a" * ((n - 9) // 2)
print(f"a{m}bcaa{m}ccbb")
|
ASSIGN VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR STRING NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING VAR STRING VAR STRING ASSIGN VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING VAR STRING VAR STRING
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
import sys
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II():
return int(sys.stdin.readline())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number):
return [LI() for _ in range(rows_number)]
def LI1():
return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number):
return [LI1() for _ in range(rows_number)]
def SI():
return sys.stdin.readline().rstrip()
inf = 10**16
md = 10**9 + 7
def solve():
n = II()
if n < 27:
ans = "".join(chr(i + 97) for i in range(n))
elif n & 1:
q, r = divmod(n, 3)
a, b, c = q, q, q + r
if q & 1 == 0:
a, b = a + 1, b - 1
ans = (
"a" * (a // 2)
+ "b" * (b // 2)
+ "c" * (c // 2)
+ "a" * (a // 2 + 1)
+ "c" * (c // 2 + 1)
+ "b" * (b // 2 + 1)
)
else:
q, r = divmod(n, 4)
a, b, c, d = q, q, q, q + r
if q & 1 == 0:
a, b, c, d = a + 1, b + 1, c - 1, d - 1
ans = ""
ans += "a" * (a // 2)
ans += "b" * (b // 2)
ans += "c" * (c // 2)
ans += "d" * (d // 2)
ans += "a" * (a // 2 + 1)
ans += "c" * (c // 2 + 1)
ans += "b" * (b // 2 + 1)
ans += "d" * (d // 2 + 1)
print(ans)
for testcase in range(II()):
solve()
|
IMPORT ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL STRING FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR VAR VAR BIN_OP VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER BIN_OP STRING BIN_OP VAR NUMBER BIN_OP STRING BIN_OP VAR NUMBER BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR VAR VAR VAR VAR BIN_OP VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR STRING VAR BIN_OP STRING BIN_OP VAR NUMBER VAR BIN_OP STRING BIN_OP VAR NUMBER VAR BIN_OP STRING BIN_OP VAR NUMBER VAR BIN_OP STRING BIN_OP VAR NUMBER VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR
|
You are given an integer n. Find any string s of length n consisting only of English lowercase letters such that each non-empty substring of s occurs in s an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.
Input
The first line contains a single integer t (1 ≤ t ≤ 500) — the number of test cases.
The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
Output
For each test case, print a single line containing the string s. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints.
Example
Input
4
3
5
9
19
Output
abc
diane
bbcaabbba
youarethecutestuwuu
Note
In the first test case, each substring of "abc" occurs exactly once.
In the third test case, each substring of "bbcaabbba" occurs an odd number of times. In particular, "b" occurs 5 times, "a" and "bb" occur 3 times each, and each of the remaining substrings occurs exactly once.
|
t = int(input())
while t:
t -= 1
n = int(input())
if n < 20:
ans = ""
for i in range(97, 97 + n):
ans += chr(i)
print(ans)
continue
if n % 2 == 0:
mid = "b"
k = n - 1
l1 = k // 2
l2 = k - l1
else:
mid = "bc"
k = n - 2
l1 = k // 2
l2 = k - l1
print("a" * l1 + mid + "a" * l2)
|
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP NUMBER VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING VAR VAR BIN_OP STRING VAR
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.