description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for _ in range(t): s = input() a = s.count("one") b = s.count("two") c = s.count("twone") if a + b == 0: print(0) print(" ") else: count = a + b - c i = 0 ans = [] while i < len(s) - 2: if s[i : i + 5] == "twone": ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR NUMBER AS...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
from sys import stdin a = lambda: stdin.readline() for _ in range(int(a())): s = [*a()] n = len(s) - 1 result, res, i = 0, [], 0 app = res.append while i < n - 2: x = "".join(s[i : i + 3]) if x == "one": result += 1 app(i + 2) elif x == "two": ...
ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER LIST NUMBER ASSIGN VAR VAR WHILE VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL STRING VAR VAR BIN_OP VAR NUMBER IF VAR STRING VAR NUMBER EXPR FUNC_CA...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input() j = 0 c = 0 l = [] if "one" in s or "two" in s: while j < len(s): if s[j : j + 5] == "twone": l.append(j + 3) j += 5 c += 1 elif s[j : j + 3] == "two": l.append(j...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST IF STRING VAR STRING VAR WHILE VAR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for i in range(int(input())): ans = [] s = input().replace("twone", "tw?ne").replace("one", "o?e").replace("two", "t?o") for ind, c in enumerate(s): if c == "?": ans.append(ind + 1) print(len(ans)) print(*ans)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING STRING STRING STRING STRING STRING FOR VAR VAR FUNC_CALL VAR VAR IF VAR STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input().strip()) for _ in range(t): s = input().strip() l = len(s) count = 0 ps = [] for i, c in enumerate(s): if i == 0 or i == l - 1: continue elif c == "n" and s[i - 1 : i + 2] == "one": if s[i - 3 : i + 2] != "twone": ps.append(str(...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR BIN_OP VAR NUMBER IF VAR STRING VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER STRING IF VAR BIN_OP VAR NU...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input() l = len(s) x = 0 y = [] i = 0 while i < l - 2: if s[i : i + 5] == "twone": x += 1 y.append(i + 3) i += 5 elif s[i : i + 3] == "one" or s[i : i + 3] == "two": x += 1 y.append(i + ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING VAR V...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
MOD = 1000000007 ii = lambda: int(input()) si = lambda: input() dgl = lambda: list(map(int, input())) f = lambda: map(int, input().split()) il = lambda: list(map(int, input().split())) ls = lambda: list(input()) for _ in range(ii()): s = ls() x = len(s) sind = set() for i in range(2, x - 2): tem...
ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for _ in range(t): s = list(input()) n = len(s) ans = [] for i in range(n - 4): sub = "".join(s[i : i + 5]) if sub == "twone": s[i + 2] = "%" ans.append(i + 3) for i in range(n - 2): sub = "".join(s[i : i + 3]) if sub == "one" ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL STRING VAR VAR BIN_OP VAR NUMBER IF VAR STRING ASSIGN VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP V...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
import sys for _ in range(int(input())): s = sys.stdin.readline() to_eliminate = [] r = 0 lens = 0 rs = "" for x in s: lens += 1 if lens >= 3 and x == "o" and s[lens - 2] == "w" and s[lens - 3] == "t": to_eliminate += [lens - 1] r += 1 if x == "e"...
IMPORT FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR VAR VAR NUMBER IF VAR NUMBER VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING VAR LIST BIN_OP VAR NUMBER VAR NUMBER IF VAR STRING VAR NUMBER...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input() i = 0 req = 0 ans = [] while i < len(s): if s[i : i + 5] == "twone": req += 1 ans.append(i + 2) i += 5 elif s[i : i + 3] == "one" or s[i : i + 3] == "two": req += 1 ans.append(i + 1)...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING VAR VAR BIN_OP VAR NUMBER STRING V...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for _ in range(t): s = input() l = len(s) res = 0 arr = [] i = 0 while i < l: if i < l - 4 and s[i : i + 5] == "twone": arr.append(i + 3) i += 5 elif i < l - 2: if s[i : i + 3] == "two": arr.append(i + 2) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR IF VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR BIN_OP VAR NUMBER IF V...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input().replace("twone", "tw_ne").replace("one", "o_e").replace("two", "t_o") A = {i for i, ch in enumerate(s, 1) if ch == "_"} print(len(A)) print(*A)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING STRING STRING STRING STRING STRING ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR NUMBER VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input() ans = [] for i in range(len(s)): if 2 <= i <= len(s) - 2 and s[i - 2 : i + 3] == "twone": ans.append(i + 1) elif i >= 2 and s[i - 2 : i + 1] == "two": ans.append(i) elif i <= len(s) - 2 and s[i : i + 3] == "one": ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF NUMBER VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER STRIN...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
I = input for _ in range(int(I())): s = list(I()) ind = [] i = 0 n = len(s) while i < n: if i + 2 < n and ( s[i] == "o" and s[i + 1] == "n" and s[i + 2] == "e" or s[i] == "t" and s[i + 1] == "w" and s[i + 2] == "o" ...
ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR VAR IF BIN_OP VAR NUMBER VAR VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING VAR VAR STRING VAR BIN_OP VAR NUMBER STRI...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for _ in range(0, t): s = input() n = len(s) ans = [] i = 0 sto = "twone" so = "one" st = "two" while i < n - 2: if i + 5 <= n and s[i : i + 5] == sto: ans.append(i + 3) i += 5 elif s[i : i + 3] == so: ans.append(i + 2)...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING WHILE VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) l2 = [] for i in range(t): s = input() k = list(s) c = 0 l1 = [] c1 = 0 while c1 < len(k) - 2: if s[c1 : c1 + 3] == "one": l1.append(c1 + 2) c1 += 3 c += 1 elif s[c1 : c1 + 3] == "two": if s[c1 + 2 : c1 + 5] == "one...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUM...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
import sys readline = sys.stdin.readline ns = lambda: readline().rstrip() ni = lambda: int(readline().rstrip()) nm = lambda: map(int, readline().split()) nl = lambda: list(map(int, readline().split())) for _ in range(ni()): s = ns() ind = [] i = 0 while i < len(s) - 2: if s[i] == "o": ...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
from sys import stdin, stdout input = stdin.readline t = int(input()) for _ in range(t): s = input()[:-1] n = len(s) ans = [] i = 1 while 1: i += 1 if i >= n: break if ( s[i] == "o" and s[i - 1] == "w" and s[i - 2] == "t" ...
ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE NUMBER VAR NUMBER IF VAR VAR IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING BIN_OP VAR NUMBER VAR VAR BIN_OP V...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): l = list(input()) n = len(l) cnt = [] for i in range(n - 2): if i + 5 <= n: if l[i : i + 5] == list("twone"): l[i + 2] = " " cnt.append(i + 3) continue if l[i : i + 3] == list("one"): l[...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER VAR IF VAR VAR BIN_OP VAR NUMBER FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBE...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
T = int(input("")) for v in range(T): a = input("") n = len(a) p = [] t = [] for i in range(n - 2): if a[i : i + 3] == "one": p.append(i) if a[i : i + 3] == "two": p.append(i) if len(p) == 0: print(0) continue ans = 0 i = 0 fin ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR V...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
rr = lambda: input().strip() rri = lambda: int(rr()) rrm = lambda: [int(x) for x in rr().split()] def sol(): s = input() n = len(s) if n < 3: print(0) print() return 0 if n > 4: res = 0 ind = [] i = 0 while i < n - 4: if s[i] + s[i + ...
ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR RETURN NUMBER IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIG...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) Ans = "" for p in range(t): s = input() l = len(s) i = 0 ans = 0 ind = "" while i < len(s) - 2: if i + 4 < len(s) and s[i : i + 5] == "twone": ind += str(i + 3) + " " ans += 1 i += 5 elif i + 2 < len(s) and s[i : i + 3] == "one...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER STRING VAR BIN_OP FUNC...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for _ in range(t): ind = [] s = list(input()) l = len(s) for i in range(2, l): if i + 2 < l: if ( s[i - 2] == "t" and s[i - 1] == "w" and s[i] == "o" and s[i + 1] == "n" and s[i + 2] == "...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
import sys input = sys.stdin.readline t = int(input()) for testcaess in range(t): S = input().strip() + "zzzzzzzz" LEN = len(S) ANS = [0] * LEN for i in range(LEN): if S[i : i + 3] == "two": if S[i + 2 : i + 5] == "one": ANS[i + 2] = 1 else: ...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR NUMBER STRING IF VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER STRING ASSIGN VA...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input() ans = [] i = 0 while i < len(s): one = False twone = False two = False if i + 3 <= len(s): if s[i : i + 3] == "two": two = True if i + 5 <= len(s) and s[i + 3 : i + 5] == "ne": ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER FUNC_CALL VAR V...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for i in range(int(input())): q = set() s = input() + "?????" for i in range(len(s)): if s[i] == "t": if s[i : i + 5] == "twone": q.add(i + 3) s = s.replace("twone", "?????") for i in range(len(s)): if s[i] == "o": if s[i : i + 3] == "one": ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for i in range(t): x, ans = str(input()), [] next = -1 for i in range(len(x) - 2): if i < next: continue if x[i] == "t" and x[i + 1] == "w" and x[i + 2] == "o": if i + 3 <= len(x) - 1 and x[i + 3] == "o": ans.append(i + 2) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING IF BIN_OP VAR NUMBER BIN_OP FUNC_CALL VAR VAR NU...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input() lst = [] n = len(s) i = 0 while i < n: if s[i] == "t": if s[i : i + 5] == "twone": lst.append(i + 2 + 1) i += 5 elif s[i : i + 3] == "two": lst.append(i + 2) i +=...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR STRING IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL V...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
import sys sin = sys.stdin t = int(sin.readline()) for i in range(t): s = sin.readline() idx = set() twones = 0 j = 0 while j < len(s) - 3: if j < len(s) - 4 and s[j : j + 5] == "twone": idx.add(str(j + 3)) j += 5 elif s[j : j + 3] == "one" or s[j : j + 3] ==...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR FUNC_CALL VAR ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
import sys input = sys.stdin.readline n = int(input()) for i in range(n): s = input().rstrip() sl = list(s) ans = set() for i in range(len(s) - 2): if s[i : i + 3] == "one" or s[i : i + 3] == "two": ans.add(i + 2) for i in range(len(s) - 4): if s[i : i + 5] == "twone": ...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BI...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input() x = len(s) ans = [] i = 0 while i < x: if s[i : i + 5] == "twone": ans.append(i + 2) i += 5 elif s[i : i + 3] == "two": ans.append(i + 1) i += 1 elif s[i : i + 3] == "one": a...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for tt in range(t): s = input().strip() arr = [] for i in s: arr.append(i) ans = [] for i in range(len(s)): if i + 4 < len(s): if ( arr[i] == "t" and arr[i + 1] == "w" and arr[i + 2] == "o" a...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRIN...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in [0] * int(input()): a = input() f = [] prev_o = -1 for j in range(len(a) - 2): if a[j] == "t" and a[j + 1] == "w" and a[j + 2] == "o": if j + 3 is not len(a) and a[j + 3] == "n": f.append(j + 2 + 1) prev_o = j + 2 else: ...
FOR VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING IF BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER STRING EXPR FUN...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) while t: t -= 1 a = input() l = len(a) s = ["z", "z"] flag1, flag2 = 0, 0 co = 0 flag3 = 0 res = [] for i in range(l): s.append(a[i]) if flag1 == 1: if a[i] == "e": ind_[2] = i flag3 = 1 else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST STRING STRING ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR IF VAR NUMBER IF VAR VAR STRING ASSIGN VAR...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
def f(s): i = 0 start = 0 a = list(s) r = [] while i != -1: i = s.find("twone", start) if i != -1: a[i + 2] = "z" r.append(i + 2 + 1) start = i + 5 s = "".join(a) i = 0 start = 0 while i != -1: i = s.find("two", start) ...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL STRING VAR ASSIGN VAR NUMB...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
def one_two(s): ch1 = "one" ch2 = "two" ch3 = "twone" final = "" i = 0 count = 0 l = [] while i < len(s): if s[i : i + 5] == ch3: l.append(i + 3) i = i + 5 elif s[i : i + 3] == ch1 or s[i : i + 3] == ch2: l.append(i + 2) i =...
FUNC_DEF ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER V...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): Answer = [] X = input() Size = len(X) Check = [0] * Size for i in range(Size - 2): if X[i] + X[i + 1] + X[i + 2] == "one": Check[i] += 1 for i in range(Size - 2): if X[i] + X[i + 1] + X[i + 2] == "two": Check[i] += 3 ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER STRING VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NU...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for ti in range(t): indices = [] s = input() i = 0 while i < len(s): if s[i] == "o" and s[i : i + 3] == "one": indices += [i + 1] i += 3 continue elif s[i] == "t": if s[i : i + 5] == "twone": indices += [i +...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR BIN_OP VAR NUMBER STRING VAR LIST BIN_OP VAR NUMBER VAR NUMBER IF VAR VAR STRING IF VAR VAR BIN_OP VAR NUMBER STRING VAR LIST BIN_OP VAR NUMBE...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
from sys import stdin for _ in range(int(input())): s = list(stdin.readline().rstrip()) l = len(s) z = [] for i in range(1, l - 1): if s[i] == "n": if s[i - 1] == "o" and s[i + 1] == "e": z.append(i + 1) s[i - 1] = s[i + 1] = s[i] = "-" if s[i...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR STRING IF VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BI...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) while t > 0: t -= 1 s = list(input().strip()) n = len(s) change = 0 ans = [] for i in range(n - 4): if "".join(s[i : i + 5]) == "twone": s[i + 2] = "-" change += 1 ans.append(i + 3) for i in range(n - 2): val = "".join(s[i ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF FUNC_CALL STRING VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR NUMBER STRING VAR NUMBER E...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for yut in range(int(input())): s = input() n = len(s) l = 0 count = 0 cont = [] b = True while l < n: b = True if l + 5 <= n: if s[l : l + 5] == "twone": count += 1 cont.append(str(l + 3)) l += 4 b =...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER VAR IF VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VA...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input() one = s.count("one") two = s.count("two") twone = s.count("twone") ans = one + two - twone l = [] i = 0 while i < len(s) - 2: if s[i : i + 3] == "one": l.append(i + 1) i += 3 elif i + 4 < len(s) and s[i : i...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
s = int(input()) def find_answer(string): n = len(string) if "one" not in string and "two" not in string: return [] res = [] if string[:3] == "one": res.append("2") if string[1:4] == "one": res.append("3") for i in range(n - 2): if string[i : i + 5] == "twone": ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR IF STRING VAR STRING VAR RETURN LIST ASSIGN VAR LIST IF VAR NUMBER STRING EXPR FUNC_CALL VAR STRING IF VAR NUMBER NUMBER STRING EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CAL...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
ones = "one" one = 0 twos = "two" two = 0 for i in range(int(input())): one, two = 0, 0 s = input() cnt = 0 a = list() for j in range(len(s)): if s[j] == ones[one]: one += 1 elif s[j] == ones[0]: one = 1 else: one = 0 if s[j] == two...
ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER IF VAR VAR VAR NUMBER ASSIGN VA...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for tc in range(int(input())): s = list(input()) temp = [] i = 0 f = 1 a = 1 while i < len(s): if s[i] == "o": if "".join(s[i : i + 3]) == "one": c = 1 temp.append(i + 1) k = i + 3 f = 1 if f: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF FUNC_CALL STRING VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
q = int(input()) for _ in range(q): s = input() n = len(s) dp = [(0) for i in range(n)] for i in range(4, n): if s[i - 4] + s[i - 3] + s[i - 2] + s[i - 1] + s[i] == "twone": dp[i - 4] = 1 dp[i - 2] = 2 dp[i] = 1 for i in range(2, n): if s[i - 2] + ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 BIN_OP BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR S...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
from sys import stdin def input(): return stdin.readline()[:-1] def intput(): return int(input()) def sinput(): return input().split() def intsput(): return map(int, sinput()) t = intput() one = list("one") two = list("two") for _ in range(t): s = input() s = list(s) cnt = 0 ta...
FUNC_DEF RETURN FUNC_CALL VAR NUMBER 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 ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input().strip() cnt = 0 res = [(i + 2) for i in range(len(s)) if s.startswith("twone", i)] cnt += len(res) s = s.replace("twone", "tw1ne") res1 = [(m + 1) for m in range(len(s)) if s.startswith("one", m)] res.extend(res1) x = len(res1) s = s.replace(...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR STRING VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR F...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for _ in range(t): s = list(input()) n = len(s) ans = [] i = 0 while i < n: if "".join(s[i : i + 5]) == "twone": ans.append(i + 3) s[i + 2] = "?" i += 5 elif "".join(s[i : i + 3]) == "one": ans.append(i + 2) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR IF FUNC_CALL STRING VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER STRING VAR NUMBER IF...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): a = list(input()) ret = [] for i, ch in enumerate(a): if ( ch == "o" and i - 2 >= 0 and i + 2 < len(a) and "".join(a[i - 2 : i + 3]) == "twone" ): ret.append(i + 1) a[i] = "z" stack = []...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR IF VAR STRING BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER FUNC_CALL VAR VAR FUNC_CALL STRING VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VA...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
import sys tests = int(sys.stdin.readline()) for _ in range(tests): stringg = str(sys.stdin.readline()) if stringg.count("one") == 0 and stringg.count("two") == 0: print("0") print() else: cnt = 0 indexesBothResult = [] indexesBoth = [] indexes = [] f...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF FUNC_CALL VAR STRING NUMBER FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR IF VAR VA...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for _ in range(t): s = input() if len(s) < 3: print(0) continue ans = [] for i in range(len(s)): if i < 2: if s[i : i + 3] == "one": ans.append(i + 1) elif i + 2 < len(s) and s[i - 2 : i + 3] == "twone": ans.append(...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER FUNC_CALL VA...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
def solve(string): n = len(string) i = 0 ans = [] while i < n: if i + 4 < n and string[i : i + 5] == "twone": ans.append(i + 2 + 1) i += 5 elif i + 2 < n and (string[i : i + 3] == "one" or string[i : i + 3] == "two"): ans.append(i + 1 + 1) ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR VAR IF BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR NUMBER IF BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER STRING VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
x = int(input()) for _ in range(x): a = input() b = len(a) lol = [] if b >= 3: i = 0 j = 1 k = 2 while i < b - 2 and k < b: if (a[i] + a[j] + a[k] == "one" or a[i] + a[j] + a[k] == "two") and k < b: f = 0 if a[i] + a[j] + a[k] =...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER VAR VAR IF BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR STRING BIN_OP BIN_OP VAR VAR VAR VAR VAR...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for nt in range(t): s = input() i = 0 count = 0 ans = [] while i < len(s) - 2: if s[i] == "t" and s[i + 1] == "w" and s[i + 2] == "o" and i + 4 >= len(s): count += 1 ans.append(i + 2) break elif ( s[i] == "t" ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CAL...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) while t != 0: t -= 1 s = input() l = [] n = len(s) for i in range(n - 4): if ( s[i] == "t" and s[i + 1] == "w" and s[i + 2] == "o" and s[i + 3] == "n" and s[i + 4] == "e" ): l.append(i + 2) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in [0] * int(input()): s = input() i = 0 r = [] while i < len(s): if "twone" == s[i : i + 5]: i += 3 r.append(i) continue if s[i : i + 3] in ("one", "two"): r.append(i + 2) i += 1 continue i += 1 pr...
FOR VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR FUNC_CALL VAR VAR IF STRING VAR VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR NUMBER STRING STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER EXPR F...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
from sys import stdin, stdout for _ in range(int(stdin.readline())): s = stdin.readline()[:-1] lst = [] n = len(s) i = 1 while i < n - 1: if s[i] == "o" and (i > 1 and i < n - 2): if s[i + 1 : i + 3] == "ne" and s[i - 2 : i] == "tw": lst.append(i) ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER IF VAR VAR STRING VAR NUMBER VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER VAR STRING EXPR FUNC_CAL...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for test in range(int(input())): b = input() a = [] c = [] for lol in range(len(b)): a.append(b[lol]) for i in range(len(a) - 1, 3, -1): if ( a[i - 4] == "t" and a[i - 3] == "w" and a[i - 2] == "o" and a[i - 1] == "n" and a[...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NU...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input() n = len(s) ct = 0 co = 0 two = set() one = set() for i in range(n - 2): if s[i] == "o" and s[i + 1] == "n" and s[i + 2] == "e": if i - 1 >= 0 and i - 2 >= 0 and s[i - 2] == "t" and s[i - 1] == "w": one.add(i + 1) ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING IF BIN_OP VAR ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): st = input() deleted = set() for i in range(2, len(st) - 2): if ( st[i - 2] == "t" and st[i - 1] == "w" and st[i] == "o" and st[i + 1] == "n" and st[i + 2] == "e" ): deleted.add(i) for i...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR VAR FO...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
from sys import stdin R = lambda: list(stdin.readline().rstrip("\n")) for _ in range(int(input())): a = R() + ["x"] * 3 v = [] for i in range(len(a) - 2): if a[i] + a[i + 1] + a[i + 2] == "two": if a[i + 2] + a[i + 3] + a[i + 4] == "one": v += (i + 3,) a[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP LIST STRING NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF BIN_OP BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER STRING IF BIN_OP ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
def main(): r = [] for _ in range(int(input())): s = ( input() .replace("twone", "tw_ne") .replace("one", "o_e") .replace("two", "t_o") ) n = s.count("_") r.append(str(n)) if n: r.append(" ".join(map(str, [i for ...
FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING STRING STRING STRING STRING STRING ASSIGN VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR VAR FUNC_C...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): arr = input() ln = len(arr) ans = [] i = 0 while i < ln: if arr[i] == "o": if i + 2 < ln and arr[i + 1] == "n" and arr[i + 2] == "e": if i - 1 >= 0 and arr[i - 1] == "o": ans.append(i + 2) else: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR STRING IF BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING IF BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER STRING EXPR FUNC_...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for _ in range(t): s = input() ind = [] n = len(s) tot = 0 ans = set() for i in range(n - 2): if s[i : i + 3] == "one": tot += 1 ans.add(i + 1) if s[i : i + 3] == "two": tot += 1 ans.add(i + 1) for i in range(n ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR BIN_OP ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) l = [] for i in range(t): l.append(str(input())) for i in l: r = 0 p = [] j = 0 while j < len(i) - 2: if i[j : j + 5] == "twone": r += 1 p.append(j + 3) j += 5 elif i[j : j + 3] == "one": r += 1 p.append(j +...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VA...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): a = input() a += "z" b = [0] * len(a) d = 1 while d < len(a) - 1: d += 1 if a[d - 2] + a[d - 1] + a[d] in ["one", "two"]: b[d - 1] += 1 for i in range(len(b) - 1): if b[i] == 1 and b[i + 2] == 1: b[i] = 0 b...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR STRING ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR NUMBER IF BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR LIST STRING STRING VAR BIN_OP VAR NUMBER NUMBE...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
N = int(input()) for _ in range(N): s = list(input()) le = len(s) res = [] b = 0 while b < le - 2: if s[b : b + 3] == list("one") or s[b : b + 3] == list("two"): if b + 4 < le and s[b : b + 5] == list("twone"): res.append(b + 3) s[b + 2] = "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 FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER FUNC_CALL VAR STRING VAR VAR BIN_OP VAR NUMBER FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER VAR VAR...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
def f(): s = list(input()) delN = set() delW = [] def checkOne(i): if s[i - 1] != "o": return if s[i + 1] != "e": return delN.add(i) def checkTwo(i): if s[i - 1] != "t": return if s[i + 1] != "o": return ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_DEF IF VAR BIN_OP VAR NUMBER STRING RETURN IF VAR BIN_OP VAR NUMBER STRING RETURN EXPR FUNC_CALL VAR VAR FUNC_DEF IF VAR BIN_OP VAR NUMBER STRING RETURN IF VAR BIN_OP VAR NUMBER STRING RETURN EXPR FUNC_CALL VAR VAR ASSIGN VAR ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for i in range(int(input())): s = input() k1 = 0 k2 = 0 count = 0 l = [] j = len(s) - 1 while j > 1: if s[j - 2] == "o" and s[j - 1] == "n" and s[j] == "e": j -= 3 count += 1 if j > 0 and s[j - 1] == "t" and s[j] == "w": l.append(j ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE VAR NUMBER IF VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING VAR VAR STRING VAR NUMBER VAR NUMBER IF VAR NUMBER VAR...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for i in range(t): s = list(input()) cnt = 0 ind = [] for i in range(len(s)): if i + 5 <= len(s): if "".join(s[i : i + 5]) == "twone": s[i + 2] = "#" cnt += 1 ind.append(i + 3) continue if i + 2 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF FUNC_CALL STRING VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR NUMBER STRING VAR NUMBER EXP...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
import sys def main(): for tc in range(int(input())): s = list(input()) ans = [] for i in range(len(s) - 2): x = "".join(s[i : i + 3]) y = "" if i < len(s) - 4: y = "".join(s[i + 2 : i + 5]) if x == "one": ans....
IMPORT FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL STRING VAR VAR BIN_OP VAR NUMBER ASSIGN VAR STRING IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL STRING VAR BI...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input() a = [] for i in s: a.append(i) a.append(1) a.append(1) a.append(1) n = len(s) if n <= 2: print(0) print("") continue ans = [] for i in range(0, n - 2): if [a[i], a[i + 1], a[i + 2]] == ["o", "n", "e...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR LIST FOR V...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
import sys input = lambda: sys.stdin.readline().rstrip("\r\n") def oneLineArrayPrint(arr): print(" ".join([str(x) for x in arr])) t = int(input()) for _ in range(t): s = list(input()) ans = [] for i in range(len(s)): if "".join(s[i : i + 5]) == "twone": ans.append(i + 3) ...
IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR 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 FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL STRING VAR VAR BIN_OP VAR N...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
def make_liked(s): i = 0 remove = [] while i < len(s) - 2: if ( i < len(s) - 4 and s[i] == "t" and s[i + 1] == "w" and s[i + 2] == "o" and s[i + 3] == "n" and s[i + 4] == "e" ): remove.append(i + 3) ...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR VAR STRING...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for i in range(t): s = input() n = len(s) ans = [""] * n ansn = 0 i = 0 while i < n: if i < n - 2: if i < n - 4 and s[i : i + 5] == "twone": ans[i + 2] = str(i + 3) + " " ansn += 1 i += 4 elif i < n ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR NUMBER BIN_O...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for i in range(t): s = input() l = len(s) rem = [] ans = 0 skip = 0 for j in range(l - 2): if skip > 0: skip -= 1 continue if j <= l - 5 and s[j : j + 5] == "twone": ans += 1 rem.append(j + 3) skip = 4 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER EXPR FUNC_CALL ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
from sys import stdin def input(): return int(stdin.readline()) def minput(): return map(int, stdin.readline().split()) def linput(): return list(map(int, stdin.readline().split())) for _ in range(input()): us = set() s = stdin.readline() m = len(s) - 2 i = 0 while i < m: ...
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 VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for i in range(0, t): count = 0 s = [] ignoreOne = False emptyS = True line = input() for f in range(0, len(line)): if line[f] == "t": if line[f : f + 5] == "twone": s.append(str(f + 3)) count = count + 1 ignore...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER A...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input() l = [] for i in range(len(s) - 2): if s[i] == "o" and s[i + 1] == "n" and s[i + 2] == "e": if len(l) > 0 and l[-1][1] and i - 1 == l[-1][0]: l.pop() l.append([i, False]) else: l.append([...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING IF FUNC_CALL VAR VAR NUMBER VAR NUMBER NUMBER BIN_OP VAR NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VA...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for i in range(int(input())): seg = list(input()) ind = [] i = 0 while i < len(seg) - 2: if seg[i] not in ("t", "o"): i += 1 elif seg[i : i + 5] == ["t", "w", "o", "n", "e"]: ind += [i + 3] i += 5 elif seg[i : i + 3] == ["t", "w", "o"] or seg[i...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING STRING VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER LIST STRING STRING STRING STRING STRING VAR LIST BIN_OP VAR NUMBER VAR NUMBER IF VAR VAR B...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
import sys input = sys.stdin.readline for _ in range(int(input())): s = input() n = len(s) check = [0] * n ans = [] for i in range(n): if s[i : i + 5] == "twone": ans.append(str(i + 3)) for j in range(i, i + 5): check[j] = 1 for i in range(n): ...
IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_O...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
a = int(input()) for x in range(a): b = input() c = len(b) d = list(b) k = 0 h = [] if c == 1 or c == 2: print(0) print() elif c == 3: if d[0] == "o": if d[1] == "n": if d[2] == "e": k += 1 d[0] = "@"...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF VAR NUMBER IF VAR NUMBER STRING IF VAR NUMBER STRING IF VAR NUMBE...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
import sys reader = (s.rstrip() for s in sys.stdin) input = reader.__next__ def solve(): s = input() ans = [] n = len(s) used = [0] * n for i in range(n): if i <= n - 5 and s[i] == "t" and s[i : i + 5] == "twone": ans.append(i + 3) used[i + 2] = 1 used[...
IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER VAR VAR STRING VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_O...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) while t: t -= 1 a = input() n = len(a) ans = [] for i in range(n): if a[i] == "o": if i < n - 2 and a[i + 1] == "n" and a[i + 2] == "e": if i > 0 and a[i - 1] == "o": ans += [i + 2] else: ans...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING IF VAR NUMBER VAR BIN_OP VAR NUMBER STRING VAR LIST BIN_OP VAR ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input() s = s.replace("twone", "tw?ne") s = s.replace("one", "o?e") s = s.replace("two", "t?o") ans = 0 ans_i = [] for i in range(len(s)): if s[i] == "?": ans += 1 ans_i.append(i + 1) print(ans) if len(ans_i) != 0: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER EXPR FUNC_CALL VAR BIN_OP...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
def solve(): S = input() l = 0 ans = [] while l < len(S) - 2: if S[l] == "o": if S[l + 1] == "n" and S[l + 2] == "e": ans.append(l + 1) l += 3 else: l += 1 elif S[l] == "t": if S[l + 1] == "w" and S[l + 2...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING IF VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER IF VAR VAR STRING IF VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) while t: res = [] s = input() i = 0 n = len(s) while i < n: if i + 4 < n: st = s[i] + s[i + 1] + s[i + 2] + s[i + 3] + s[i + 4] if st == "twone": res.append(i + 2 + 1) i = i + 5 else: st = s[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR VAR IF BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER IF VAR ST...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
import sys input = sys.stdin.readline inf = 100000000000000000 mod = 998244353 for CASES in range(int(input())): S = input().strip() if len(S) < 3: print(0) print() continue A = [S[0], S[1]] ANS = [] for i in range(2, len(S)): if S[i] == "e" and A[-1] == "n" and A[-2...
IMPORT ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
def twelve(s): dellst = [] i = 0 while i <= len(s) - 3: if s[i : i + 3] == "one": dellst += [i + 2] i += 3 elif s[i : i + 3] == "two": if i <= len(s) - 5: if s[i : i + 5] == "twone": dellst += [i + 3] ...
FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING VAR LIST BIN_OP VAR NUMBER VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING VAR LIST BIN_OP VAR NUMBER VAR NUMBER VAR LIST BIN...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
out = [] for i in range(int(input())): s, ans = list(input()), [] for j in range(2, len(s)): tem = "".join(s[j - 2 : j + 1]) if tem == "one": ans.append(str(j)) s[j - 1] = "o" elif tem == "two": if j < len(s) - 2 and "".join(s[j : j + 3]) == "one": ...
ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR LIST FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL STRING VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER STRING IF V...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for tests in range(int(input())): A = input() num = 0 x = [] for s in range(len(A) - 2): if A[s : s + 3] == "one": if num == 0 or x[-1] != s + 1: x.append(s + 2) num += 1 elif A[s : s + 3] == "two": if A[s : s + 5] == "twone": ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING IF VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER S...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
def test(s): n = len(s) d = set() for i in range(n - 4): if s[i : i + 5] == "twone": d.add(i + 2 + 1) for i in range(n - 2): if ( s[i : i + 3] == "two" and i + 2 + 1 not in d or s[i : i + 3] == "one" and i + 1 not in d )...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING BIN_OP BIN_OP VAR NUMBER NUMBER VAR VAR VAR BIN_OP VAR...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
import sys readline = sys.stdin.readline T = int(readline()) Ans = [None] * T so = ord("o") sn = ord("n") se = ord("e") st = ord("t") sw = ord("w") inf = 10**9 + 7 for qu in range(T): S = list(map(ord, readline().strip())) N = len(S) Ans = [] for i in range(2, N - 2): s = S[i] if s != s...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NONE VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for i in range(t): s = str(input()) arr = [] s += "111" j = 0 while j <= len(s) - 2: q = s[j : j + 3] p = s[j + 2 : j + 5] if q == "one": arr.append(j + 2) j += 3 elif q == "two": if p == "one": arr....
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 VAR STRING ASSIGN VAR NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF VAR STRING EXPR FUNC_CALL VAR BIN_OP V...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): l = list(input()) ans = 0 for t in range(2, len(l) - 2): if l[t] == "o" and l[t - 1] == "w" and l[t - 2] == "t": if l[t + 1] == "n" and l[t + 2] == "e": ans += 1 l[t] = "1" for t in range(1, len(l) - 1): if l[t] ==...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING IF VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING VAR NUMBER ASSI...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
t = int(input()) for i in range(t): s = input() ss = [] c = 0 j = 0 while j < len(s) - 2: if s[j : j + 5] == "twone": ss.append(j + 3) c = c + 1 j = j + 5 elif s[j : j + 3] == "two": ss.append(j + 2) c = c + 1 j ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VA...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in [0] * int(input()): s = input() ans = "" NumAns = 0 i = 0 N = len(s) while i <= N - 3: if s[i : i + 3] == "one": NumAns += 1 ans += str(i + 1 + 1) + " " i = i + 3 elif s[i : i + 3] == "two": if i + 5 <= N and s[i : i + 5] =...
FOR VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR BIN_OP VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER VAR BIN_OP FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER STRING ASSIGN VAR BIN_OP ...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
n = int(input()) for i in range(n): z = input() + " " x = len(z) a = [] q = 0 w = 0 while q < x - 2: if z[q : q + 3] == "one": a.append(q + 2) q += 2 w += 1 elif z[q : q + 3] == "two": if z[q + 2 : q + 5] == "one": ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER IF VAR VAR B...
You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ...
for _ in range(int(input())): s = input() result, c, j = list(), 0, 0 while j < len(s) - 2: if s[j : j + 5] == "twone": result.append(j + 3) c += 1 j += 5 elif s[j : j + 3] == "two": result.append(j + 2) c += 1 j += 3 ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP...