description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
l = input() n = len(l) k = [(0) for i in range(n)] for t in range(1, n): if l[t] != l[t - 1]: k[t - 1] = 1 if l[-1] == "b": k[-1] = 0 else: k[-1] = 1 print(*k)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER IF VAR NUMBER STRING ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = str(input()) n = len(s) ansarr = [0] * len(s) i = 0 first = 0 while i < n: if s[i] == "b": while i < n and s[i] != "a": i += 1 if i == n: break elif first != 0: ansarr[i - 1] = 1 first = 0 else: while i < n and s[i] == "a": ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR STRING WHILE VAR VAR VAR VAR STRING VAR NUMBER IF VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
def reverse(s, index): s1 = s[: index + 1] s1 = s1[::-1] s1 = s1 + s[index + 1 :] return s1 def main(): s = input() n = len(s) ans = [] for i in range(len(s) - 1): if s[i] != s[i + 1]: s = reverse(s, i) ans.append(1) else: ans.append(...
FUNC_DEF ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR EX...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
def rev(s, n): x = s[0:n][::-1] return str(x + s[n:]) s = input() n = len(s) ans = "" for i in range(n - 1): if s[i] == "a" and s[i + 1] == "b": s = rev(s, i + 1) ans += "1 " elif s[i] == "b" and s[i + 1] == "a": s = rev(s, i + 1) ans += "1 " else: ans += "0...
FUNC_DEF ASSIGN VAR VAR NUMBER VAR NUMBER RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR STRING IF VAR VAR STRING VAR...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
import sys a = input() res = ["0"] * len(a) i = 1 while i < len(a): if i > 1 and a[i - 1] != a[i]: res[i - 1] = "1" i += 1 if i != 1 and a[i - 1] == "a": res[i - 1] = "1" sys.stdout.write(" ".join(res))
IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUMBER STRING VAR NUMBER IF VAR NUMBER VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR FUNC_...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = list(input()) res = [] for i in range(len(s) - 1): if s[i] != s[i + 1]: res.append(1) s = s[: i + 1][::-1] + s[i + 1 :] else: res.append(0) print(*res, 0 if s < s[::-1] else 1)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR NUMBER NUMBER NUMBER
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
gcd = lambda a, b: gcd(b, a % b) if b else a def main(): arr = input() sa = 0 for i in arr: if i == "a": sa += 1 brr = [(0) for i in range(len(arr))] for i in range(len(arr) - 1): if arr[i] != arr[i + 1]: arr = arr[: i + 1][::-1] + arr[i + 1 :] b...
ASSIGN VAR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBE...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() ans = [(0) for i in range(len(s))] for i in range(1, len(s)): if s[i] == "a" and s[i - 1] == "b" or s[i] == "b" and s[i - 1] == "a": ans[i - 1] = 1 s = s[0:i][::-1] + s[i:] if s[-1] == "a": ans[-1] = 1 print(*ans)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR VAR STRING VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER VAR VAR IF VAR NUMBER STRIN...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
from itertools import combinations from sys import setrecursionlimit, stdin setrecursionlimit(200000) def reverse_check_big(string, index): temp = string[: index + 1] forward = "".join(temp) reverse = "".join(temp[::-1]) if reverse > forward: return True else: return False def c...
EXPR FUNC_CALL VAR NUMBER FUNC_DEF ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL STRING VAR ASSIGN VAR FUNC_CALL STRING VAR NUMBER IF VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_DEF ASSIGN...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
def ans(s): flag = True for i in s: if i == "b": flag = False if flag: return [(0) for i in s] h = [] for i in range(len(s)): j = len(s) - 1 - i if s[j] == "a": if j == 0: return [(0) for i in s] f = ans(s[j - 1 :: -...
FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING ASSIGN VAR NUMBER IF VAR RETURN NUMBER VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER VAR IF VAR VAR STRING IF VAR NUMBER RETURN NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER RE...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s, out = list(input()), [] last = s[0] for i in range(len(s)): if i < len(s) - 1: if last == "a" and s[i] == "b" and s[i + 1] == "a": out.append(1) last = "b" elif last == "b" and s[i] == "a" and s[i + 1] == "b": out.append(1) last = "a" else: ...
ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR LIST ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR STRING VAR VAR STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR STRING IF VAR STRING VAR VAR STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_C...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
def g_couple(itr): a = next(itr) for b in itr: yield a, b a = b def g_input(str): nb = 0 for c in str: if c != " ": nb = nb * 10 + int(c) else: yield nb nb = 0 yield nb def main(): l_char = list(input()) l_char.reverse()...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR VAR VAR ASSIGN VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR EXPR VAR ASSIGN VAR NUMBER EXPR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR STR...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() o = ["0"] * len(s) a = s[0] for i in range(1, len(s)): if a == s[i]: o[i - 1] = "1" a = s[i - 1] if a == "b": o[-1] = "1" print(" ".join(o))
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER STRING ASSIGN VAR VAR BIN_OP VAR NUMBER IF VAR STRING ASSIGN VAR NUMBER STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
st = input() ans = "" k = 0 while len(st) > k and st[k] == "a": k += 1 ans += "0 " while len(st) > k and st[k] == "b": k += 1 ans += "0 " for i in range(k, len(st)): if st[i - 1] != st[i]: ans += "1 " else: ans += "0 " if st[-1] == "a": ans += "1" else: ans += "0" ans = a...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR VAR VAR VAR STRING VAR NUMBER VAR STRING WHILE FUNC_CALL VAR VAR VAR VAR VAR STRING VAR NUMBER VAR STRING FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER VAR VAR VAR STRING VAR STRING IF VAR NUMBER STRING VAR STRIN...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() ANS = [] s = s + "b" now = s[0] if now == "a": i = s.index("b") elif "a" in s: i = s.index("a") else: i = 0 while i < len(s) - 1: if s[i] == "a" and s[i + 1] == "b": ANS.append(i) elif s[i] == "b" and s[i + 1] == "a": ANS.append(i) i += 1 LIST = [(0) for i in range(le...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR VAR NUMBER IF VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF STRING VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR VAR IF VAR...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() n = len(s) dp = [] dp.append([]) dp.append([]) dp[0].append((s[0], [0])) dp[1].append((s[0], [0])) for i in range(1, len(s)): t0, sw0 = dp[0][i - 1] t1, sw1 = dp[1][i - 1] g = (t1 + s[i])[::-1] if t0 + s[i] > g: sw = sw1.copy() sw.append(1) dp[0].append((g, sw)) e...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR LIST EXPR FUNC_CALL VAR LIST EXPR FUNC_CALL VAR NUMBER VAR NUMBER LIST NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VA...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
import sys input = sys.stdin.readline mii = lambda: map(int, input().split()) s = input().strip() a1 = "" a2 = [] b1 = "" b2 = [] for ch in s: got = [a1 + ch, b1 + ch, ch + a1[::-1], ch + b1[::-1]] arr = [a2 + [0], b2 + [0], a2 + [1], b2 + [1]] a3 = min(got) idx = got.index(a3) a4 = arr[idx] b3...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR LIST ASSIGN VAR STRING ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR LIST BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER ASSIGN VAR LIST BIN_OP VAR LIST NUMBER B...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() c = "ab" j = 0 i = len(s) r = [0] * i try: while 1: i = s.rindex(c[j], 0, i) r[i] = 1 j ^= 1 except: print(*r)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR WHILE NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER VAR ASSIGN VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() n = len(s) ans = [] bpt = n - 1 while bpt > 0: if s[bpt] == "a": ans.append(1) bpt -= 1 while bpt > 0 and s[bpt] == "a": ans.append(0) bpt -= 1 if bpt > 0 and s[bpt] != "a": ans.append(1) bpt -= 1 else: ans.appen...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER IF VAR VAR STRING EXPR FUNC_CALL VAR NUMBER VAR NUMBER WHILE VAR NUMBER VAR VAR STRING EXPR FUNC_CALL VAR NUMBER VAR NUMBER IF VAR NUMBER VAR VAR STRING EXPR FUNC_CALL VAR NUMBER VAR NUMBER EXPR FUNC_CALL...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
from sys import stdin, stdout def ii(): return int(stdin.readline()) def mi(): return map(int, stdin.readline().split()) def li(): return list(mi()) def si(): return stdin.readline() s = input() ans = [0] * 1007 for i in range(1, len(s)): if s[i] == "a": ans[i - 1] ^= 1 ans...
FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING VAR BIN_OP VAR NU...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() i = 0 result = [] n = len(s) i = 0 j = 0 while i < n and j < n: if s[i] == "a": j = i + 1 while j < n and s[j] == "a": j += 1 if i - 1 >= 0: result.append(i - 1) result.append(j - 1) i = j + 1 else: i += 1 for i in range(n): ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR VAR VAR STRING VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = list(input()) a = [(0) for i in range(len(s))] for i in range(1, len(s)): if s[i] == "a": a[i] = 1 a[i - 1] ^= 1 print(" ".join(list(map(str, a))))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL VAR VAR VAR
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() n = len(s) l = [(0) for i in range(n)] a = "a" b = "b" c = a for i in range(n - 1, -1, -1): if c == s[i]: l[i] = 1 if c == a: c = b else: c = a for i in l: print(i, end=" ")
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR ASSIGN VAR VAR NUMBER IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
def not_last(c): if c == "a": return "b" return "a" s = input() last = "b" res = [] for i in range(len(s) - 1): if s[i + 1] == last: res += [0] else: last = not_last(last) res += [1] if last == "a": res += [1] else: res += [0] print(" ".join(list(map(str, res)))...
FUNC_DEF IF VAR STRING RETURN STRING RETURN STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR VAR LIST NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR LIST NUMBER IF VAR STRING VAR LIST NUMBER VAR LIST NUMBER EXPR FUNC_CALL VAR F...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() l = [] i = 0 while i < len(s): l.append(0) while i < len(s) and s[i] == "b": l[-1] += 1 i += 1 l.append(0) while i < len(s) and s[i] == "a": l[-1] += 1 i += 1 i = 0 res = [] for j, e in enumerate(l): i += e if j % 2 == 0: if i != e and l[j + 1]...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR STRING VAR NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR STRING VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() n = len(s) min_str = "".join(sorted(list(s))) res = [] for i in range(n - 1, -1, -1): if not s[i] == min_str[i]: tail = min_str[i + 1 :] s_lst = reversed(list(min_str[: i + 1])) new_s = "".join(s_lst) min_str = new_s + tail res.append(1) else: res.appe...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL ST...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
def flip(wd): changes = [] last = wd[0] for i, x in enumerate(wd): if x != last: changes.append(i - 1) last = x changes.append(len(wd) - 1) if wd[-1] == "b": changes.pop(-1) res = [0] * len(wd) for ch in changes: res[ch] = 1 return res def te...
FUNC_DEF ASSIGN VAR LIST ASSIGN VAR VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR VAR ASSIGN VAR VAR NUMBER ...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() def swap(i): return s[:i:-1] + s[i + 1 :] for e in range(len(s) - 1): if s[e] != s[e + 1]: print(1, end=" ") else: print(0, end=" ") if s[-1] == "a": print(1, end=" ") else: print(0)
ASSIGN VAR FUNC_CALL VAR FUNC_DEF RETURN BIN_OP VAR VAR NUMBER VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER STRING IF VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
def main(): s = list(input().strip()) i = -1 n = len(s) b = [0] * n for j in range(n): if s[j] == "a": if i != -1: b[i] ^= 1 b[j - 1] ^= 1 i = j if i != -1: b[i] = 1 for x in b: print(x, end=" ") print() ma...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR NUMBER VAR VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR IF VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR EXPR FUNC_CALL V...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input().strip() n = len(s) cond = s[0] ans = [] for i in range(n - 1): if s[i + 1] == cond: ans.append("0") else: ans.append("1") cond = s[i + 1] if cond == "b": ans.append("0") else: ans.append("1") print(" ".join(ans))
ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR BIN_OP VAR NUMBER IF VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRIN...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() ans = [] for i in range(len(s) - 1): if s[i] != s[i + 1]: ans.append(i) ans.append(len(s) - 1) if s[-1] == "b": ans = ans[: len(ans) - 1] an = [0] * len(s) for i in ans: an[i] = 1 print(*an, sep=" ")
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FO...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() n = len(s) ans = [] s += "b" for i in range(n): if s[i] == "b" and s[i + 1] == "a" or s[i] == "a" and s[i + 1] == "b": ans.append(1) else: ans.append(0) print(*ans)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR VAR STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() output = [] best = s[0] rev = False s2 = s[1:] for i in s2: if i <= best: output.append(rev) rev = True best = i else: output.append(not rev) rev = False output.append(not rev) for i in output: if i: print(0, end=" ") else: print(1, end...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR VAR IF VAR EXPR FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR NUM...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() n = len(s) ans = [0] * n for i in range(1, n): if s[i] == "a": if ans[i - 1] == 0: ans[i - 1] = 1 else: ans[i - 1] = 0 ans[i] = 1 print(*ans)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR STRING IF VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR VAR
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() n = len(s) revs = [0] * n c = "a" toc = {"a": "b", "b": "a"} for i in range(n - 1, -1, -1): if s[i] == c: c = toc[c] revs[i] = 1 print(" ".join(map(str, revs)))
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR STRING ASSIGN VAR DICT STRING STRING STRING STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
def main(): l = list(input()) wyn = [0] * len(l) pos = 0 for i in range(1, len(l)): if l[i] == "a": wyn[i - 1] ^= 1 wyn[i] ^= 1 print(*wyn, sep=" ") main()
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING VAR BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
from sys import stdin, stdout a = list(input()) b = sorted(a) l = len(a) ans = ["0" for i in range(l)] for i in range(1, l): if a == b: break if a[0] == "a": if a[i] == "a": a[0 : i - 1] = a[i - 1 : 0 : -1] ans[i - 1] = "1" elif a[i] == "b": a[0 : i - 1] = a[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR IF VAR NUMBER STRING IF VAR VAR STRING ASSIGN VAR NUMBER BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
seq = input() result = [] len_ = len(seq) result.append("0") if len_ > 1: for i in range(1, len_ - 1): if seq[i] == "b" and seq[i + 1] == "a": result.append("1") elif seq[i] == "a" and seq[i + 1] == "b": result.append("1") else: result.append("0") if s...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR STRING IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VA...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() r = [] for i in s: if i == "a": if len(r) != 0: r[-1] = 1 - r[-1] r.append(1) else: r.append(0) print(" ".join(map(str, r)))
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR IF VAR STRING IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER BIN_OP NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = list(input()) n = len(s) lis = [-1] * n lis[0] = 0 for i in range(n - 1): if s[i] == s[i + 1]: lis[i] = 0 i = n - 1 while i >= 0 and s[i] != "a": lis[i] = 0 i -= 1 while i >= 0: if lis[i] == -1: lis[i] = 1 i -= 1 print(*lis)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER VAR VAR STRING ASSIGN VAR VAR NUMBER VAR NUMBER WHIL...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
def Main(): arr = input() n = len(arr) res = {} res[0] = 0 for i in range(1, n): if arr[i] == "a": res[i - 1] ^= 1 res[i] = 1 else: res[i] = 0 for x in res: print(res[x], end=" ") Main()
FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR DICT ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR STRING VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR VAR STRING EXPR FUNC_CALL VAR
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() n = len(s) ans = [(0) for i in range(n)] i = 0 while True: while i != n and s[i] == "a": i += 1 if i != 0: ans[i - 1] = 1 if i == n: break while i != n and s[i] == "b": i += 1 if i == n: break else: ans[i - 1] = 1 for i in ans: prin...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE NUMBER WHILE VAR VAR VAR VAR STRING VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR WHILE VAR VAR VAR VAR STRING VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER FOR VAR...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input().strip() n = len(s) ans = [0] * n i = 0 while i < n: j = i + 1 if s[i] == "b": while j < n and s[j] == "b": j += 1 if j != n: ans[j - 1] = 1 while j < n and s[j] == "a": j += 1 ans[j - 1] = 1 i = j print(*ans)
ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR STRING WHILE VAR VAR VAR VAR STRING VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER WHILE VAR VAR VAR VAR STRING VAR NUMBER ASSIGN VAR BIN_O...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() + "b" a = list(s) x = [0] for i in range(1, len(a) - 1): if a[i] != a[i + 1] and a[i + 1] == a[0]: h = a[: i + 1] k = list(reversed(h)) a = k + a[i + 1 :] x.append(1) else: x.append(0) print(*x)
ASSIGN VAR BIN_OP FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() t = s[0] for i in range(1, len(s)): if s[i] == t: t = s[i - 1] print("1 ", end="") else: print("0 ", end="") if t == "b": print(1) else: print(0)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING STRING EXPR FUNC_CALL VAR STRING STRING IF VAR STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() out = [0] * len(s) k2 = 0 if s[0] == "a": for i in range(len(s) - 1): if s[i] == "b" and s[i + 1] == "a": k1, k2 = i, i for j in range(k2 + 1, len(s)): if s[j] == "b": break k2 += 1 out[k1] = 1 ou...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER STRING FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING ASSIGN VAR VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMB...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() c = 0 for i in range(len(s)): if s[i] == "a" and c == 0: c = 1 if i != len(s) - 1: if s[i + 1] == "a": print(0, end=" ") else: print(1, end=" ") else: print(1, end=" ") elif s[i] == "b" and c == 0: pr...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER ASSIGN VAR NUMBER IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER STRING IF VAR VAR STRING VA...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
t = input() i = 0 res = [(0) for _ in range(len(t))] while i < len(t): if t[i] == "a": j = i + 1 while j < len(t) and t[j] == "a": j += 1 if i != 0: res[i - 1] = 1 res[j - 1] = 1 i = j else: i += 1 print(" ".join(map(str, res)))
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR WHILE VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR STRING VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER ASSIGN V...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() ss = sorted(s) r = [0] * len(s) b_char = "b" for i, c in enumerate(reversed(s)): if c != b_char: r[len(s) - i - 1] = 1 b_char = "a" if b_char == "b" else "b" print(" ".join([str(i) for i in r]))
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIGN VAR VAR STRING STRING STRING EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VA...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
inputs = [s for s in input()] array_a = [] result = [0] * len(inputs) for i in range(len(inputs)): if inputs[i] == "a": array_a.append(i) if len(array_a) == 0: pass else: i = 0 while i < len(array_a): counter = 1 while i + 1 < len(array_a) and array_a[i] + 1 == array_a[i + 1]: ...
ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR NUMBER FUNC_CALL VAR VAR BIN_OP V...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
def solve(word): swaps = [False] * len(word) modified = word for i in range(1, len(word)): if word[i] != word[i - 1]: swaps[i - 1] = True modified = modified[i - 1 :: -1] + modified[i:] if modified[0] != "a": swaps[-1] = True modified = modified[::-1] ...
FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR VAR IF VAR NUMBER STRING ASSIGN VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER RETURN VA...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() o = "" for i, c in enumerate(s[:-1]): if c == "b": if s[i + 1] == "a": s = s[: i + 1][::-1] + s[i + 1 :] o += "1" else: o += "0" elif s[i + 1] == "b": o += "1" s = s[: i + 1][::-1] + s[i + 1 :] else: o += "0" if s[0] == ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR VAR FUNC_CALL VAR VAR NUMBER IF VAR STRING IF VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER VAR STRING VAR STRING IF VAR BIN_OP VAR NUMBER STRING VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VA...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
s = input() ans = [0] * len(s) for i in range(1, len(s) - 1): if s[0] == "a" and s[i : i + 2] == "ba" or s[0] == "b" and s[i : i + 2] == "ab": s = s[: i + 1][::-1] + s[i + 1 :] ans[i] = 1 if s[-1] == "a": s = s[::-1] ans[-1] = 1 print(" ".join(str(i) for i in ans))
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER STRING VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR V...
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly bored and usually thinks how to make her entertainment more interesting. Today, when IA looked at the fridge, she noticed that...
def check(current, source_final_ch): if current[-1] != source_final_ch: current.reverse() return 1, current[:-1] return 0, current[:-1] def calc(source): actions = [] best = sorted(source) current = best for i in range(len(source)): res = check(current, source[-i - 1]) ...
FUNC_DEF IF VAR NUMBER VAR EXPR FUNC_CALL VAR RETURN NUMBER VAR NUMBER RETURN NUMBER VAR NUMBER FUNC_DEF ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR NUMBER VAR RETURN VAR FUNC...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() def count(s): d = {} for c in s: d[c] = d.get(c, 0) + 1 return d dt = count(t) maxY = 0 maxW = 0 arr = [False] * len(s) for i in range(len(s)): c = s[i] if c in dt and dt[c] > 0: maxY += 1 dt[c] -= 1 arr[i] = True for i in range(len(s)): ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
msg = input() nwp = input() aa = [(0) for i in range(26)] bb = [(0) for i in range(26)] cc = [(0) for i in range(26)] dd = [(0) for i in range(26)] for i in msg: if ord(i) < 95: bb[ord(i) - 65] += 1 else: aa[ord(i) - 97] += 1 for i in nwp: if ord(i) < 95: dd[ord(i) - 65] += 1 els...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER VAR BIN_OP FUNC...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
def tanya_and_postcard(tanya_message, newspaper_letters): difference = ord("a") - ord("A") yays_count = 0 whoopses_count = 0 letters_counts = get_letters_counts(newspaper_letters) tanya_message = list(tanya_message) for index in range(0, len(tanya_message)): letter = tanya_message[index]...
FUNC_DEF ASSIGN VAR BIN_OP FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR VAR VAR NUMBER VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR NUMBER FOR...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() kek, lol = dict(), dict() for x in s: kek[x] = kek.get(x, 0) + 1 for x in t: lol[x] = lol.get(x, 0) + 1 res11, res2 = 0, 0 for x in kek: val = min(kek[x], lol.get(x, 0)) res11 += val kek[x] -= val lol[x] = lol.get(x, 0) - val for x in kek: if "a" <= x <= "z": ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR NUM...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
def main(s1, s2): def flip(c): if ord(c) in range(ord("a"), ord("z") + 1): return chr(ord("A") - ord("a") + ord(c)) else: return chr(ord("a") - ord("A") + ord(c)) m = [(0) for i in range(256)] for c in s2: m[ord(c)] += 1 a = 0 b = 0 marked = set(...
FUNC_DEF FUNC_DEF IF FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR STRING NUMBER RETURN FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR VAR RETURN FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
r = input() h = input() r_dic = {} h_dic = {} for c in r: h_dic[c] = 0 if c in r_dic: r_dic[c] += 1 else: r_dic[c] = 1 for c in h: if c in h_dic: h_dic[c] += 1 else: h_dic[c] = 1 y = 0 o = 0 for k, v in r_dic.items(): if r_dic[k] > h_dic[k]: r_dic[k] -= h_...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR NUMBER IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR IF VAR VAR VAR VAR VAR VAR VAR VAR...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() s = list(s) d = {} for i in range(len(t)): if t[i] in d: d[t[i]] += 1 else: d[t[i]] = 1 yay, whoop = 0, 0 for i in range(len(s)): if s[i] in d and d[s[i]] > 0: yay += 1 d[s[i]] -= 1 s[i] = " " for i in range(len(s)): if 65 <= ord(s[i]) <= 9...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER VAR VAR VAR...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() alp = [] countalp = [] salp = [] scountalp = [] yay = 0 woops = 0 for i, x in enumerate(s): if x not in alp: alp.append(x) n = s.count(x) countalp.append(n) for i, x in enumerate(t): if x not in salp: salp.append(x) n = t.count(x) scountalp...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CAL...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
S = input() T = input() N = len(S) deg = [(0) for i in range(300)] for i in range(len(T)): deg[ord(T[i])] += 1 yay = 0 whp = 0 used = [(False) for i in range(3 * 10**5)] for i in range(N): if deg[ord(S[i])] >= 1: yay += 1 deg[ord(S[i])] -= 1 used[i] = True for i in range(N): if used[...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL ...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
def to_dict(text): out = {} for letter in text: out[letter] = out.get(letter, 0) + 1 return out s = input() t = input() parsed_s = to_dict(s) parsed_t = to_dict(t) yays = 0 for letter in parsed_s: matches = min(parsed_s[letter], parsed_t.get(letter, 0)) if matches > 0: yays += matc...
FUNC_DEF ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER VAR VAR ...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() arrS = [0] * 70 arrT = [0] * 70 for i in range(len(s)): arrS[ord(s[i]) - ord("A")] += 1 for i in range(len(t)): arrT[ord(t[i]) - ord("A")] += 1 yay = 0 whoops = 0 for i in range(70): temp = min(arrS[i], arrT[i]) yay += temp arrT[i] -= temp arrS[i] -= temp for i in range(2...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING N...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input().strip() t = input().strip() yay = 0 whoops = 0 yay_map = [0] * 58 whoops_map = [] * 58 slength = len(s) tlength = len(t) s_map = [0] * 58 t_map = [0] * 58 up_low_distance = 32 for i in range(slength): s_map[ord(s[i]) - 65] += 1 for i in range(tlength): t_map[ord(t[i]) - 65] += 1 for i in range(26): ...
ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMB...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
def muda_case(letra): if letra.isupper(): return letra.lower() else: return letra.upper() a = input() b = input() contagem1 = {i: (0) for i in a} contagem2 = {i: (0) for i in b} for e in a: contagem1[e] += 1 for e in b: contagem2[e] += 1 YAY = WHOOPS = 0 for e in contagem1: if e in...
FUNC_DEF IF FUNC_CALL VAR RETURN FUNC_CALL VAR RETURN FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER VAR VAR ASSIGN VAR VAR NUMBER VAR VAR FOR VAR VAR VAR VAR NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR VAR WHILE VAR VAR NUMBER VAR VAR NUMBER VAR NUM...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
entrada1 = input() entrada2 = input() masc1 = [0] * 30 masc2 = [0] * 30 minc1 = [0] * 30 minc2 = [0] * 30 for letra in entrada1: if letra.islower(): minc1[ord(letra) - ord("a")] += 1 else: masc1[ord(letra) - ord("A")] += 1 for letra in entrada2: if letra.islower(): minc2[ord(letra) -...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING NUMBER VAR BIN_OP FUNC_CALL VAR VAR FUNC_CA...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = str(input()) t = str(input()) y, w = 0, 0 def oposto(caractere): if caractere.isupper(): return caractere.lower() else: return caractere.upper() hasht = {} for i in t: if i in hasht: hasht[i] += 1 else: hasht[i] = 1 hashs = {} for i in s: if i in hashs: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FUNC_DEF IF FUNC_CALL VAR RETURN FUNC_CALL VAR RETURN FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR ...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
def cov(ch): if ch >= "a" and ch <= "z": return ord(ch) - ord("a") else: return ord(ch) - ord("A") + 26 lt1 = list(map(cov, input())) lt2 = list(map(cov, input())) cnt = [0] * 52 for x in lt2: cnt[x] += 1 ans0 = 0 ans1 = 0 for i in range(0, len(lt1)): x = lt1[i] if cnt[x]: ...
FUNC_DEF IF VAR STRING VAR STRING RETURN BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING RETURN BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
u = input() v = input() a = [(0) for i in range(200)] b = [(0) for i in range(200)] m = 0 n = 0 d = ord("a") - ord("A") for i in u: a[ord(i)] += 1 for i in v: b[ord(i)] += 1 for i in range(ord("A"), ord("Z") + 1): r = min(a[i], b[i]) + min(a[i + d], b[i + d]) n += r m += min(a[i] + a[i + d], b[i] + ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR STRING FUNC_CALL VAR STRING FOR VAR VAR VAR FUNC_CALL VAR VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR NUMBER FOR VA...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
a = list(input()) b = list(input()) cnt = 0 scnt = 0 a1, b1 = dict(), dict() for s in a: if s in a1.keys(): a1[s] += 1 else: a1[s] = 1 for s in b: if s in b1.keys(): b1[s] += 1 else: b1[s] = 1 for s in a1.keys(): if s in b1.keys(): if a1[s] < b1[s]: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR IF VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR I...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() cnt = [0] * 257 used = [0] * (len(s) + 100) for i in range(len(t)): cnt[ord(t[i])] += 1 res1 = 0 res2 = 0 for i in range(len(s)): if cnt[ord(s[i])] > 0: cnt[ord(s[i])] -= 1 res1 += 1 used[i] = 1 for i in range(len(s)): if used[i] == 0: if cnt[ord(s[i])...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR FUNC_CALL VAR V...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
x = input() t = input() d = dict() for i in t: if i in d: d[i] += 1 else: d[i] = 1 s = [] for i in x: s.append([i, 0]) s.sort(reverse=True) ura = 0 opa = 0 for i in range(len(s)): if s[i][0] in d: if d[s[i][0]] > 0: ura += 1 s[i][1] = 1 d[s[i][...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR LIST VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VA...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() n = len(s) made = [False] * n a = [0] * 130 for c in t: a[ord(c)] += 1 yay = whoops = 0 for i in range(n): if a[ord(s[i])] > 0: a[ord(s[i])] -= 1 yay += 1 made[i] = True for i in range(n): if made[i] == False: c = s[i] if c.islower() and a[ord(...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR FUNC_CALL VAR VAR VAR NUMBER VAR FUNC_CALL VAR VAR VAR NUMBER VAR NUMBER A...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s1 = input() s2 = input() TAM = 26 a_min = ord("a") a_mai = ord("A") ls1_min = [0] * TAM ls1_mai = [0] * TAM ls2_min = [0] * TAM ls2_mai = [0] * TAM for letra in s1: if letra.islower(): ls1_min[ord(letra) - a_min] += 1 else: ls1_mai[ord(letra) - a_mai] += 1 for letra in s2: if letra.islower(...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR VAR IF FUNC_CALL VAR VAR BIN_OP FUNC_CALL VA...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s1 = input() s2 = input() ms1 = [0] * 26 ms2 = [0] * 26 ms3 = [0] * 26 ms4 = [0] * 26 m = 0 n = 0 for i in range(len(s1)): if ord(s1[i]) in range(ord("A"), ord("Z") + 1): ms1[ord(s1[i]) - ord("A")] += 1 else: ms2[ord(s1[i]) - ord("a")] += 1 for i in range(len(s2)): if ord(s2[i]) in range(ord...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CA...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
def main(): s, t = input(), input() mappingS = list(s) mappingT = list(t) yay = 0 whoops = 0 offset = ord("A") - ord("a") for i in range(ord("a"), ord("z") + 1, 1): sLower = mappingS.count(chr(i)) tLower = mappingT.count(chr(i)) sUpper = mappingS.count(chr(i + offset)...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR STRING FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR STRING NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
def tanya(s, t): def invert(ch): if ch.isupper(): return ch.lower() return ch.upper() yay = 0 whoops = 0 S = {} T = {} for x in s: if x in S: S[x] += 1 else: S[x] = 1 for x in t: if x in T: T[x] += 1 ...
FUNC_DEF FUNC_DEF IF FUNC_CALL VAR RETURN FUNC_CALL VAR RETURN FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR VAR IF VAR VAR VAR VAR VAR VAR VAR V...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() occur = [(0) for i in range(len(s))] t_freq = {} for i in t: try: t_freq[i] += 1 except: t_freq[i] = 1 y_count = 0 w_count = 0 for i in range(len(s)): try: if t_freq[s[i]] > 0: y_count += 1 t_freq[s[i]] -= 1 occur[i] = 1 ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR DICT FOR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR NUMBER VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER F...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() dict_t = dict() for letter in t: dict_t[letter] = dict_t.get(letter, 0) + 1 yay = 0 whoops = 0 remaining = "" for letter in s: if letter in dict_t and dict_t[letter] > 0: yay += 1 dict_t[letter] -= 1 else: remaining += letter for letter in remaining: if le...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR VAR IF VAR VAR VAR VAR NUMBER VAR NUMBER VAR VAR NUMBER VAR VAR FOR VAR VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR VAR FU...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() M = {} for c in t: if c not in M: M[c] = 0 M[c] += 1 marked = [False] * len(s) yay = 0 whoops = 0 for i in range(len(s)): c = s[i] if marked[i]: continue if c in M and M[c] > 0: yay += 1 M[c] -= 1 marked[i] = True for i in range(len(s))...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR IF VAR VAR VAR VAR NUMBER VAR NUMBER VAR...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
def getIndex(ch): if ord("Z") >= ord(ch) >= ord("A"): return ord(ch) - ord("A") else: return 26 + ord(ch) - ord("a") s = input().strip() t = input().strip() l = [0] * 52 yay = 0 whoop = 0 ls = [0] * len(s) for i in range(len(t)): l[getIndex(t[i])] += 1 for i in range(len(s)): if l[getI...
FUNC_DEF IF FUNC_CALL VAR STRING FUNC_CALL VAR VAR FUNC_CALL VAR STRING RETURN BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING RETURN BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER ASS...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() yay = 0 whoops = 0 dic = {} resto = "" def inverter(c): if c.isupper(): return c.lower() else: return c.upper() for c in t: try: dic[c] += 1 except: dic[c] = 1 for c in s: try: if dic[c] > 0: dic[c] -= 1 yay ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR STRING FUNC_DEF IF FUNC_CALL VAR RETURN FUNC_CALL VAR RETURN FUNC_CALL VAR FOR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER VAR NUMBER VAR VAR VAR VAR FOR VAR VAR...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
alpha = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", ...
ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STR...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s1 = input() s2 = input() lista1 = [0] * 150 lista2 = [0] * 150 for i in range(len(s1)): lista1[ord(s1[i]) - ord("A")] += 1 for i in range(len(s2)): lista2[ord(s2[i]) - ord("A")] += 1 ans1 = 0 for i in range(100): matchs = min(lista1[i], lista2[i]) ans1 += matchs lista1[i] -= matchs lista2[i] -=...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING N...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() cnt = [0] * 300 used = [0] * len(s) for c in t: cnt[ord(c)] += 1 c1 = 0 c2 = 0 for i in range(len(s)): c = s[i] if cnt[ord(c)] > 0: c1 += 1 cnt[ord(c)] -= 1 used[i] = 1 for i in range(len(s)): c = s[i] if used[i] == 0 and cnt[ord(c) ^ 32] > 0: ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR FU...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s, t = input(), input() count = dict() for c in t + s: count[c.upper()] = 0 count[c.lower()] = 0 for c in t: count[c] += 1 yay, woops = 0, 0 temp = "" for c in s: if count[c] > 0: yay += 1 count[c] -= 1 else: temp += c for c in temp: if c == c.upper() and count[c.lower()]...
ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR STRING FOR VAR VAR IF VAR VAR NUMBER VAR NUMBER VAR VAR NUMBER VAR VAR FOR VAR VAR IF VAR FUNC_CAL...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
alpha = "abcdefghijklmnopqrstuvwxyz" alpha += alpha.upper() h1 = {i: (0) for i in alpha} h2 = {i: (0) for i in alpha} for i in input(""): h1[i] += 1 for i in input(""): h2[i] += 1 y = w = 0 for i in alpha: y += min(h1[i], h2[i]) h1[i], h2[i] = max(0, h1[i] - h2[i]), max(0, h2[i] - h1[i]) for i in alpha:...
ASSIGN VAR STRING VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER VAR VAR ASSIGN VAR VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR STRING VAR VAR NUMBER FOR VAR FUNC_CALL VAR STRING VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR VAR VAR VAR F...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() n = len(s) yay = 0 whoops = 0 dict = {} for c in s: if c in dict: dict[c] += 1 else: dict[c] = 1 t2 = "" for c in t: if c in dict: yay += 1 dict[c] -= 1 if dict[c] == 0: del dict[c] else: t2 += c for c in t2: if c.is...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR STRING FOR VAR VAR IF VAR VAR VAR NUMBER VAR VAR NUMBER IF VAR VAR NUMBER VAR VAR VAR VAR FOR VAR VAR IF FUNC_CALL VAR...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
message = input() newspaper = input() dict_letter = {} dict_letterBoolean = [] yay = 0 whoops = 0 for l in message: if l in dict_letter: dict_letter[l] = dict_letter[l] + 1 else: dict_letter[l] = 1 for l in newspaper: if l in dict_letter and dict_letter[l] > 0: dict_letter[l] = dict_...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL V...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() def id(c): if "a" <= c <= "z": return ord(c) - ord("a") return ord(c) - ord("A") + 26 cnt = [0] * 52 Free = [0] * len(s) yay, whoops = 0, 0 for i in t: cnt[id(i)] += 1 for i in range(len(s)): if cnt[id(s[i])] > 0: yay += 1 cnt[id(s[i])] -= 1 Fr...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF IF STRING VAR STRING RETURN BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING RETURN BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR VA...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() a, b = {}, [] for i in t: if i in a: a[i] += 1 else: a[i] = 1 for i in s: b.append(i) res1, res2 = 0, 0 for i in range(len(b)): if b[i] in a and a[b[i]] > 0: res1 += 1 a[b[i]] -= 1 b[i] = "0" for i in b: t = i if i.islower(): ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR DICT LIST FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR VAR ST...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() def count(s): d = {} for c in s: d[c] = d.get(c, 0) + 1 return d def compare(h1, h2): y = 0 for key, val in h2.items(): if key in h1: y += min(h1[key], val) return y dt = count(t) ds = count(s) maxY = compare(dt, ds) dt = count(t.lower())...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER RETURN VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR IF VAR VAR VAR FUNC_CALL VAR VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIG...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
msg = input() nsp = input() yay = 0 whoops = 0 no_yay = [] nsp_l = {} for l in set(nsp): nsp_l[l] = nsp.count(l) for c in msg: if c in nsp_l.keys() and nsp_l[c] > 0: nsp_l[c] -= 1 yay += 1 else: no_yay.append(c) for c in no_yay: if c.islower(): if c.upper() in nsp_l.keys(...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FOR VAR VAR IF VAR FUNC_CALL VAR VAR VAR NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR VAR IF FUNC_CALL VAR IF FUNC_CALL VAR ...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
desejadas = input() recortadas = input() YAY = 0 WHOOPS = 0 desejo = {} possuo = {} for rec in desejadas: if rec not in desejo: desejo[rec] = 1 else: desejo[rec] += 1 for rec in recortadas: if rec not in possuo: possuo[rec] = 1 else: possuo[rec] += 1 for chave in desejo: ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR VAR VA...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
def change(x): if x == x.upper(): return x.lower() if x == x.lower(): return x.upper() s, t = input(), input() L = [0] * 256 for i in t: L[ord(i)] += 1 ans1 = ans2 = 0 P = [] for i in s: x = ord(i) if L[x] > 0: L[x] -= 1 ans1 += 1 else: P.append(i) for i...
FUNC_DEF IF VAR FUNC_CALL VAR RETURN FUNC_CALL VAR IF VAR FUNC_CALL VAR RETURN FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR N...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input() t = input() s_letters = dict() t_letters = dict() CAPS = "QWERTYUIOPASDFGHJKLZXCVBNM" SMALLS = "qwertyuiopasdfghjklzxcvbnm" for letter in CAPS: s_letters[letter] = 0 t_letters[letter] = 0 for letter in SMALLS: s_letters[letter] = 0 t_letters[letter] = 0 for letter in s: s_letters[letter]...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR VAR VAR NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
def foo(): s = input() d = {} for key in s: d[key] = d.get(key, 0) + 1 return d def f(s): d = {} for key in s.keys(): if ord(key) > ord("Z"): c = chr(ord(key) - ord("a") + ord("A")) d[c] = d.get(c, 0) + s[key] else: d[key] = d.get(key...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER RETURN VAR FUNC_DEF ASSIGN VAR DICT FOR VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIG...
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The...
s = input().strip() t = input().strip() ls = len(s) lt = len(t) d = {} yays = 0 whoops = 0 missed = [] for c in t: if c not in d: d[c] = 0 d[c] += 1 for c in s: if c in d and d[c]: yays += 1 d[c] -= 1 else: missed.append(c) for c in missed: k = c.swapcase() if k i...
ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR VAR NUMBER VAR VAR NUMBER EXPR FU...