s_id string | p_id string | u_id string | date string | language string | original_language string | filename_ext string | status string | cpu_time string | memory string | code_size string | code string | error string | stdout string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s581762032 | p04030 | u124063060 | 1593139548 | Python | Python (3.8.2) | py | Runtime Error | 124 | 27304 | 576 | import bisect,collections,copy,heapq,itertools,math,numpy,string
from fractions import gcd
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) # tupleも検討する。
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
N = S()
L = [i for i in N]
for i, num in enumerate(L):
if(i != 0 and num == "B"):
L[i-1] = ""
L.remove("B")
print("".join(L))
if __name__ == '__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpyh72sfay/tmpilmel4cd.py", line 2, in <module>
from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
| |
s499055399 | p04030 | u971811058 | 1593124976 | Python | Python (3.8.2) | py | Runtime Error | 21 | 8904 | 532 | #include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header
int main() {
string s, ans="";
cin >> s;
for(auto x : s){
if(x!='B') ans+=x;
else if(ans!="") ans.pop_back();
}
cout << ans << endl;
return 0;
} | File "/tmp/tmpt5qccoj0/tmp19qn2ipr.py", line 2
// Begin Header {{{
^^
SyntaxError: invalid syntax
| |
s507845038 | p04030 | u697615293 | 1593092882 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8956 | 262 | a = list(input())
b = []
for i,j in enumerate(a):
if j == str("0"):
b += str("0")
elif j == str("1"):
b += str("1")
elif j == str("B"):
if not b:
pass
else:
del b[i-1]
print("".join(b)) | Traceback (most recent call last):
File "/tmp/tmp5q9242lb/tmpe1ev6aph.py", line 1, in <module>
a = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s332112135 | p04030 | u697615293 | 1593092717 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8868 | 273 | a = list(input())
b = []
for i,j in enumerate(a):
if j == str("0"):
b += str("0")
elif j == str("1"):
b += str("1")
elif j == str("B"):
if a[0] == str("B"):
pass
else:
del b[i-1]
print("".join(b)) | Traceback (most recent call last):
File "/tmp/tmp1h5q5qs7/tmpojbt2yfq.py", line 1, in <module>
a = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s233760654 | p04030 | u697615293 | 1593091812 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9104 | 195 | a = list(input())
b = []
for i,j in enumerate(a):
if j == str("0"):
b += str("0")
elif j == str("1"):
b += str("1")
else:
del b[i-1]
print("".join(b))
| Traceback (most recent call last):
File "/tmp/tmp_82z4lql/tmp09sb_yoh.py", line 1, in <module>
a = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s311462571 | p04030 | u333591669 | 1593042979 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8932 | 352 | def sig():
key=[input()] q
a=key[0]
if a =='0':
key.append('0')
elif a=='1':
key.append('1')
else:
key.append('')
for i in key:
b=key[i]
if b =='0':
key.append('0')
elif b=='1':
key.append('1')
else:
key.pop(i-1)
print(key)
sig()
| File "/tmp/tmpzdv5ygk_/tmp6o1uss5b.py", line 2
key=[input()] q
^
SyntaxError: invalid syntax
| |
s398667105 | p04030 | u014333473 | 1592949576 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8880 | 164 | s=input()
b=False
result = []
for i in s:
if i=='B':
if not b:
result.pop()
b=True
else:
b=False
result.append(i)
print(''.join(result)) | Traceback (most recent call last):
File "/tmp/tmp6vcyxrr9/tmppicgwqgu.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s200220653 | p04030 | u804954217 | 1592929235 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8888 | 130 | s = input()
txt = []
for c in s:
if c == 'B' && len(txt) > 0:
txt.pop()
else:
txt.append(c)
print(''.join(txt))
| File "/tmp/tmpt45eejks/tmp1umhjm9q.py", line 5
if c == 'B' && len(txt) > 0:
^
SyntaxError: invalid syntax
| |
s925160120 | p04030 | u804954217 | 1592929177 | Python | Python (3.8.2) | py | Runtime Error | 21 | 9008 | 131 | s = input()
txt = []
for c in s:
if c == 'B' and len(txt) > 0:
txt.pop()
elif:
txt.append(c)
print(''.join(txt))
| File "/tmp/tmpx49btu0p/tmpr7n6g5_m.py", line 7
elif:
^
SyntaxError: invalid syntax
| |
s497545751 | p04030 | u804954217 | 1592929153 | Python | Python (3.8.2) | py | Runtime Error | 29 | 8912 | 129 | s = input()
txt = []
for c in s:
if c == 'B' && len(txt) > 0:
txt.pop()
elif:
txt.append(c)
print(''.join(txt)) | File "/tmp/tmpifsp_6ar/tmpudnz50fb.py", line 5
if c == 'B' && len(txt) > 0:
^
SyntaxError: invalid syntax
| |
s307439951 | p04030 | u344813796 | 1592875323 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9088 | 194 | s=list(str(input()))
ans=[]
for i in s:
if i=='1':
ans.append('1')
elif i=='0':
ans.append(0,'0')
else:
if ans:
ans.pop(-1)
else:
continue
print(''.join(ans)) | Traceback (most recent call last):
File "/tmp/tmpt1yc7vv8/tmp5_iyxe6t.py", line 1, in <module>
s=list(str(input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s441422005 | p04030 | u344813796 | 1592875081 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9072 | 155 | s=list(str(input()))
ans=[]
for i in s:
if i=='1':
ans.append('1')
elif i=='0':
ans.insert(0,'0')
else:
ans.pop(-1)
print(''.join(ans)) | Traceback (most recent call last):
File "/tmp/tmp7lxa6zky/tmpn77wg_s9.py", line 1, in <module>
s=list(str(input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s788790224 | p04030 | u131881594 | 1592329695 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 162 | s=input()
ans=""
for b in s:
if b=="1":
ans+="1"
elif b=="0":
ans+="0"
else:
if len(ans)!=0:
ans[-1]=""
print(ans) | Traceback (most recent call last):
File "/tmp/tmpcv9prt90/tmp3j3ay5yn.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s214204406 | p04030 | u124212130 | 1591970500 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 115 | S = input()
ANS = ""
for i in range(len(S)):
if S[i] == B:
ANS = ANS[:-1]
else:
ANS += S[i]
print(ANS) | Traceback (most recent call last):
File "/tmp/tmp_wf6lme6/tmpd4l4xwzp.py", line 1, in <module>
S = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s920489014 | p04030 | u350093546 | 1591753577 | Python | PyPy3 (2.4.0) | py | Runtime Error | 171 | 38256 | 125 | s=input()
x=''
for i in s:
if i=='B':
if i!='':
x=x.replace(x[-1],'')
else:
x+=i
print(x) | Traceback (most recent call last):
File "/tmp/tmpgphu7cwi/tmph0vr6a1w.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s384108778 | p04030 | u293825440 | 1591639002 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 292 | moji = []
ans=""
s = str(input())
s = list(s)
def keyboard(key,list):
if key == "0":
list.append("0")
elif key == "1":
list.append("1")
elif key == "B":
list.pop(-1)
for i in range(len(s)):
keyboard(s[i],moji)
for x in moji:
ans += x
print(ans) | Traceback (most recent call last):
File "/tmp/tmp3bqzwco9/tmp1tfqnvyt.py", line 3, in <module>
s = str(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s824321535 | p04030 | u757274384 | 1591334775 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 184 | # -*- coding : utf-8 -*-
S = str(input())
w = ""
for i in range(len(S)):
if S[i] = "B":
if w == "":
w = ""
else :
w = w.rstrip()
else:
w + S[i]
print(w)
| File "/tmp/tmpbfwg0l2x/tmpvojdkv_e.py", line 7
if S[i] = "B":
^^^^
SyntaxError: cannot assign to subscript here. Maybe you meant '==' instead of '='?
| |
s984379472 | p04030 | u757274384 | 1591334718 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 184 | # -*- coding : utf-8 -*-
S = str(input())
w = ""
for i in range(len(S)):
if S[i] = "B":
if w != "":
w = ""
else :
w = w.rstrip()
else:
w + S[i]
print(w)
| File "/tmp/tmpl72zto22/tmpwk4qoi8j.py", line 7
if S[i] = "B":
^^^^
SyntaxError: cannot assign to subscript here. Maybe you meant '==' instead of '='?
| |
s480723066 | p04030 | u757274384 | 1591334602 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 185 | # -*- coding : utf-8 -*-
S = str(input())
w = ""
for i in range(len(S)):
if S[i] = "B":
if w == "":
w = ""
else :
w.remove(w[-1])
else:
w + S[i]
print(w)
| File "/tmp/tmpnjzwam5c/tmpaglcboln.py", line 7
if S[i] = "B":
^^^^
SyntaxError: cannot assign to subscript here. Maybe you meant '==' instead of '='?
| |
s868083017 | p04030 | u757274384 | 1591334572 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 184 | # -*- coding : utf-8 -*-
S = str(input())
w = ""
for i in range(len(S)):
if S[i] = "B":
if w != "":
w = ""
else :
w.remove(w[-1])
else:
w + S[i]
print(w) | File "/tmp/tmpxvo79qcw/tmp9lc0r9fy.py", line 7
if S[i] = "B":
^^^^
SyntaxError: cannot assign to subscript here. Maybe you meant '==' instead of '='?
| |
s700664138 | p04030 | u736474437 | 1591269746 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 110 | s=input()
l=list()
for i in str(s):
if i == "B":
del l[-1]
else:
l.append(i)
a="".join(l)
print(a) | Traceback (most recent call last):
File "/tmp/tmpo5y79_eq/tmpivvy03nj.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s699710177 | p04030 | u730769327 | 1591177052 | Python | PyPy3 (2.4.0) | py | Runtime Error | 163 | 38512 | 150 | s=input()
n=len(s)
a=[]
b=""
for i in range(s):
if s[i]=="B":
a.pop()
else:
a.append(s[i])
for i in range(len(a)):
b+=a[i]
print(b)
| Traceback (most recent call last):
File "/tmp/tmp_xm88rxw/tmpn66pb09j.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s447125101 | p04030 | u199356004 | 1591166858 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 185 | S=input()
result = []
for c in list(S):
if c == 'B' and len(result)>0:
result.pop(-1)
elif c== 'B':
result = ""
else :
result.append(c)
print("".join(result))
| Traceback (most recent call last):
File "/tmp/tmpl46ummfo/tmp8ydwv1sw.py", line 1, in <module>
S=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s099587670 | p04030 | u946288218 | 1590846724 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 168 | a = input()
ans = ""
for i in range(len(a)):
if a[i] == 'B' or (i + 1 < len(a) and a[i + 1] == 'B'):
continue
else:
ans = ans + a[i]
print(ans) | Traceback (most recent call last):
File "/tmp/tmp8_7fpm0w/tmpyyb41bw8.py", line 1, in <module>
a = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s891081221 | p04030 | u946288218 | 1590846626 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2820 | 166 | a = input()
ans = ""
for i in range(len(a)):
if i + 1 < len(a) and a[i + 1] == 'B' or a[i] == 'B':
continue
else:
ans = ans + a[i]
print(ans) | Traceback (most recent call last):
File "/tmp/tmp09ra11ym/tmputxdc12s.py", line 1, in <module>
a = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s413356467 | p04030 | u435721973 | 1590816114 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 174 | li = list(input())
line = []
for i in li:
if i == "0":
line.append("0")
elif i == "1":
line.append("1")
else:
line.pop(len(line) - 1)
print("".join(line)) | Traceback (most recent call last):
File "/tmp/tmp94xnzi08/tmp7rqdkcul.py", line 1, in <module>
li = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s123975102 | p04030 | u552738814 | 1590555280 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 397 | s = input()
s_list = []
input_list = []
for i in range(len(s)):
s_list.append(s[i])
for i2 in range(len(s)):
if s_list[i2] == "0":
input_list.append("0")
elif s_list[i2] == "1":
input_list.append("1")
elif s_list[i2] == "B" and input_list != 0:
input_list.pop(-1)
else:
pass
for i3 in range(len(input_list)):
print(input_list[i3],end="")
| Traceback (most recent call last):
File "/tmp/tmphh7h2sym/tmpfzmoa0qn.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s103555384 | p04030 | u007886915 | 1590408611 | Python | Python (3.4.3) | py | Runtime Error | 158 | 13624 | 12066 | # -*- coding: utf-8 -*-
import sys
import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque
#input = stdin.readline
j=0
k=0
n=3
r=1
a=[0]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"
#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
print(number_list[i-1])#
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''
x=[]
y=[]
for i in range(N):
x1, y1=[int(i) for i in input().split()]
x.append(x1)
y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''
'''
mixlist=[]
for i in range(N):
a,b=input().split()
mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ,今回はリスト一つで処理している"
'''
'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''
#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]
print(type(N))
print(N)
print(type(M))
print(M)
print(type(table))
print(table)
'''
#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値.桁ごとに分割したい.入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ
#intを取ると文字列分解に使える
'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''
'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''
'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''
#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"
#a,b=map(int, input().split()) #int style 複数数値入力 「A B」みたいなスペース空いた入力のとき
#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成
##############################################################################################
##############################################################################################
#under this line explains example calculation
'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''
#nCr combination
'''
def cmb(n,r):
#When n < r , this function isn't valid
r= min(n-r,r)
#print(n,r)
if r == 0: return 1
over = reduce(mul, range(n, n-r, -1))
#flochart mul(n,n-1)=x
#next mul(x,n-2)........(n-r+1,n-r)
#mul read a,b and returns a*b
under = reduce(mul, range(1, r+1))
#print(over, under)
#reduce is applied mul(1,2)=2
#next mul(2,3)=6
#next mul(6,4)=4.........last(r!,r+1)=r+1!
return over // under
#// is integer divide
#calc example 5C2
#over=5*4*3
#under=3*2*1
a = cmb(n, r)
#print(a)
'''
'''
import itertools
from itertools import combinations_with_replacement
combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし
combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり
使用例 出力
combinations('ABCD', 2) AB AC AD BC BD CD
combinations_with_replacement('ABCD', 2) AA AB AC AD BB BC BD CC CD DD
'''
'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位n個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
#(1, 6)
#(3, 3)
#(4, 1)
'''
#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''
'''
素数の判定
'''
def is_prime(n):
if n == 1: return False
for k in range(2, int(np.sqrt(n)) + 1):
#sqrt(n)+1以上は考えて約数はないので却下
if n % k == 0:
return False
#割り切れたらFalse
return True
'''
npのmaxとmaximumの違い
xs = np.array([1, -2, 3])
np.max(xs, 0)
この出力は3となります.[1, -2, 3]と0の4つの数字のうち,最も大きい値を出力します.
一方で,[max(1, 0), max(-2, 0), max(3, 0)]を出力したい時があります.
その時は,numpyのmaximum関数を用います.
xs = np.array([1, -2, 3])
np.maximum(xs, 0) # [1, 0, 3]
'''
def factorial(x, mod=10**9+7):
# x!
# 階乗
# ex) factorial(5) = 120
tmp = 1
for i in range(1, x+1):
tmp = (tmp * i) % mod
return tmp
'''
Basically, when you do a**d % n, you actually have to calculate a**d, which could be quite large.
But there are ways of computing a**d % n without having to compute a**d itself, and that is what pow does.
'''
########################################################################
########################################################################
#b2=a[:] #1次元のときはコピーはこれで良い
#print(b2)
#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a) #2次元配列はこうコピーする
#print(b3)
'''
ascii_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
digits = '0123456789'
hexdigits = '0123456789abcdefABCDEF'
letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv...\xaf\xb0...
lowercase = 'abcdefghijklmnopqrstuvwxyz'
octdigits = '01234567'
printable = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU...
punctuation = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
whitespace = '\t\n\x0b\x0c\r '
'''
'''
引数endに任意の文字列を指定すると、その文字列が改行の代わりに最後に挿入される。例えば連続するprint()の出力を改行なしで単純に連結したい場合は空文字列''を指定すればよい。
print('abc', end='---')
print('xyz')
# abc---xyz
print('abc', end='')
print('xyz')
# abcxyz
source: print_basic.py
なお、デフォルトで改行されるのは引数endのデフォルト値が改行文字'\n'に設定されているから。
'''
def main():
n=3
steps=0
state=0
w=1
j=0
k=0
#lenを変数に置くと事故るから注意
#n=int(input())
#a,b=input().split(" ")#a,bがともに文字列のとき
#a,b=map(int, input().split(" "))
#mapでとってもstrで変換すればappend可能
s=input()
a=[i for i in s]#int(i)にすれば数字も行ける
n=len(s)
c=[]
for i in range(n):
if a[i]=="0":
c.append("0")
elif a[i]=="1":
c.append("1")
elif a[i]==("B"):
del c[-1]
#d=str(c)
#print(c)
#print("".join(d))
print("".join(c))
#nl=list(map(int, input().split(" ")))#数字の時
#print(a)
#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(brray)
#for i in range(1,n+1,2):#これで1個飛ばしループになる
# pass
#print(i)
l = ['aaa', 'bbb', 'ccc']
x=l.index('aaa')#ある要素のインデックス番号を取得
#s = ''.join(l)
#s = " ".join(map(str,a))#スペースを空ける時はこう
#print(s)
# aaabbbccc
#if state in known_states and not flag: # state => 2 steps => 5
#こうやってある要素がリストの中にあるか探すのか
#print(f'steps: {steps}, state: {state}')
#こう書いてあるとデバックしやすい
#dp= [[0]*3 for i in range(5)]#列 行
#dp用の0の入ったやつ
#dp= [[0]*(w+1) for i in range(n+1)]#0からwまでのw+1回計算するから
#print(dp)#初期条件が入る分計算回数+1列分必要(この場合は判断すべきものの数)
DP = np.zeros(w+1, dtype=int)#これでも一次元リストが作れる
exdp=np.zeros((3,4)) # 3×4の2次元配列を生成。2次元ならこう
#dtypeは指定しないとfloatになる
#for i in range(n):#ちょっとした入力に便利
# a, b = map(int, input().split())
#dp[i][0] += [a]
#これだとintとlistをつなぐことになって不適
# dp[i] += [a]
# dp[i] += [b]
#これはうまくいく
#やり方はいろいろあるということ
#print(dp)
#brray=[list(map(int, input().split(" ")))for i in range(N)
#print(brray)
'''
入力
1234
出力
[1, 2, 3, 4]
'''
pin_l=["x" for i in range(10)]#内包表記に慣れろ
#print(pin_l)
ls = ["a", "b", "c", "d", "e"]
#print(ls[2:5])
#スライスでの取得
#print(ls[:-3])
#一番左端から右から3番目より左まで取得
#print(ls[:4:2])
#スライスで1個飛ばしで取得
#ないときは左端スタート
#始点のインデックス番号 : 終点のインデックス番号 : スキップする数+1
#print(ls[::2])
'''
lsというリストの場合に、1つ飛びの値を取得したい場合には
ls[::2]
のようにします。こうすると、
["a", "c", "d"]と出力される
'''
if __name__ == "__main__":
main()
| Traceback (most recent call last):
File "/tmp/tmp3uxigrqj/tmpk83dubko.py", line 442, in <module>
main()
File "/tmp/tmp3uxigrqj/tmpk83dubko.py", line 351, in main
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s124344774 | p04030 | u604655161 | 1590285874 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 345 | def ABC_43_B():
s = input()
t=[]
for i in range(len(s)):
if s[i] == '0':
t.append('0')
elif s[i] == '1':
t.append('1')
else:
if len(t)==0:
a=0
else:
del t[i-1]
print(''.join(t))
if __name__ == '__main__':
ABC_43_B() | Traceback (most recent call last):
File "/tmp/tmpq8i9gwjf/tmpblmzsq46.py", line 22, in <module>
ABC_43_B()
File "/tmp/tmpq8i9gwjf/tmpblmzsq46.py", line 2, in ABC_43_B
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s699486403 | p04030 | u564004296 | 1589993558 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3316 | 543 | import collections
#文字列を一文字ずつ取得したいとき
def inputStrOnebyOne():
s = list(input())
return s
#整数を一つずつリストに入れる
def inputOnebyOne_Int():
a = list(int(x) for x in input().split())
return a
def main():
s = inputStrOnebyOne()
ret = []
for i in range(len(s)):
if s[i] == "0":
ret.append(s[i])
elif s[i] == "1":
ret.append(s[i])
else:
ret.pop()
print(''.join(ret))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmp6dg5h8p3/tmp65fvtynm.py", line 26, in <module>
main()
File "/tmp/tmp6dg5h8p3/tmp65fvtynm.py", line 14, in main
s = inputStrOnebyOne()
^^^^^^^^^^^^^^^^^^
File "/tmp/tmp6dg5h8p3/tmp65fvtynm.py", line 5, in inputStrOnebyOne
s = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s695384180 | p04030 | u679089074 | 1589742277 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 162 | S = input()
cha = list(S)
plist = []
for i in cha:
if i == "B":
del plist[-1]
else:
plist.append(i)
plist = "".join(plist)
print(plist) | Traceback (most recent call last):
File "/tmp/tmpbictjjob/tmpk8a8h5vb.py", line 1, in <module>
S = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s822794341 | p04030 | u379142263 | 1589300593 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 380 | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9+7
s = input()
q = [""]
for i in range(len(s)):
if s[i] == "0":
q.append(0)
elif s[i] == "1":
q.append(1)
else:
q.pop()
ans = ""
for i in range(len(q)):
ans += str(q[i])
print(ans) | Traceback (most recent call last):
File "/tmp/tmp_8kyl8e9/tmp7hihnlh2.py", line 9, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s409927590 | p04030 | u379142263 | 1589300486 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 378 | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9+7
s = input()
q = []
for i in range(len(s)):
if s[i] == "0":
q.append(0)
elif s[i] == "1":
q.append(1)
else:
q.pop()
ans = ""
for i in range(len(q)):
ans += str(q[i])
print(ans) | Traceback (most recent call last):
File "/tmp/tmp5yit07lw/tmpkmkl4ru4.py", line 9, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s975411891 | p04030 | u702686470 | 1588987806 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 201 | s = input()
l = len(s)
t=[]
for i in range(l):
c = s[i]
if c=='B':
if len(t)==0:
continue
else:
t.remove(t[len-1])
else:
t.append(c)
print(t) | Traceback (most recent call last):
File "/tmp/tmp4indkog3/tmpqfij13yt.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s980921055 | p04030 | u702686470 | 1588987722 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 199 | s = input()
l = len(s)
t=[]
for i in range(l):
c = s[i]
if c=='B':
if len(t)==0:
continue
else:
t.remove(t[i-1])
else:
t.append(c)
print(t) | Traceback (most recent call last):
File "/tmp/tmpe4t6gobp/tmpr5t_hif1.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s899083878 | p04030 | u444722572 | 1588783000 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 265 | from collections import deque
s=deque(list(input()))
p=deque()
for i in range(len(s)):
w=s.popleft()
if w=="0":
p.append("0")
elif w=="1":
p.append("1")
else:
p.pop()
for i in range(len(p)):
print(p[i],end="")
| Traceback (most recent call last):
File "/tmp/tmp1nahibi9/tmpbj9jkhhj.py", line 2, in <module>
s=deque(list(input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s235877141 | p04030 | u453055089 | 1588752968 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 246 | s = input()
ans = []
dp = [""]*(len(s))
if s[0] != "B":
dp[0] = s[0]
else:
dp[0] = [""]
for i in range(len(s)-1):
if s[i+1] != "B":
dp[i+1] = dp[i] + s[i+1]
else:
dp[i+1] = dp[i][:len(dp[i])-1]
print(dp[len(s)-1]) | Traceback (most recent call last):
File "/tmp/tmpwn_cbso6/tmpdk62ip7x.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s336667181 | p04030 | u453055089 | 1588752884 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 272 | s = input()
ans = []
dp = [""]*(len(s))
if s[0] != "B":
dp[0] = s[0]
else:
dp[0] = [""]
#print(dp)
for i in range(len(s)-1):
if s[i+1] != "B":
dp[i+1] = dp[i] + s[i+1]
else:
dp[i+1] = dp[i][:len(dp[i])-1]
#print(dp)
print(dp[len(s)-1]) | Traceback (most recent call last):
File "/tmp/tmpuu3j7hon/tmpok2_zyd3.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s727381922 | p04030 | u453055089 | 1588752855 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38384 | 272 | s = input()
ans = []
dp = [""]*(len(s))
if s[0] != "B":
dp[0] = s[0]
else:
dp[0] = [""]
#print(dp)
for i in range(len(s)-1):
if s[i+1] != "B":
dp[i+1] = dp[i] + s[i+1]
else:
dp[i+1] = dp[i][:len(dp[i])-1]
#print(dp)
print(dp[len(s)-1]) | Traceback (most recent call last):
File "/tmp/tmp09nsd20u/tmpdp9xuqro.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s624509866 | p04030 | u453055089 | 1588752717 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38256 | 262 | s = input()
ans = []
dp = [""]*(len(s))
if s[0] != "B":
dp[0] = s[0]
else:
dp[0] = [""]
#print(dp)
for i in range(len(s)-1):
if s[i+1] != "B":
dp[i+1] = dp[i] + s[i+1]
else:
dp[i+1] = dp[i][:-1]
#print(dp)
print(dp[len(s)-1]) | Traceback (most recent call last):
File "/tmp/tmpse9m6eod/tmpsj1rw8v2.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s855816043 | p04030 | u453055089 | 1588752110 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38384 | 400 | s = input()
ans = []
dp = [""]*(len(s))
if s[0] != "B":
dp[0] = s[0]
else:
dp[0] = [""]
#print(dp)
for i in range(len(s)-1):
if s[i+1] != "B":
if dp[i] != "":
dp[i+1] = dp[i] + s[i+1]
else:
dp[i+1] = s[i+1]
else:
if dp[i] != "":
dp[i+1] = dp[i][:-1]
else:
dp[i+1] = ""
#print(dp)
print(dp[len(s)-1]) | Traceback (most recent call last):
File "/tmp/tmpbiwdz4bf/tmpd5ipe99i.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s808062606 | p04030 | u453055089 | 1588751720 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38384 | 395 | s = input()
ans = []
dp = [-1]*(len(s))
if s[0] != "B":
dp[0] = s[0]
else:
dp[0] = [-1]
#print(dp)
for i in range(len(s)-1):
if s[i+1] != "B":
if dp[i] != -1:
dp[i+1] = dp[i] + s[i+1]
else:
dp[i+1] = s[i+1]
else:
if dp[i] != -1 and i-1 >= 0:
dp[i+1] = dp[i-1]
else:
dp[i+1] = -1
print(dp[len(s)-1]) | Traceback (most recent call last):
File "/tmp/tmpamr6ziv2/tmpbvljtlkd.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s105602692 | p04030 | u586206420 | 1588511403 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 342 | s=list(input())
t=["3","3","3","3","3","3","3","3","3","3"]
m=0
for i in range(0, len(s)):
if s[i]=="B":
if m > 0:
t[m-1]="3"
m=m-1
if s[i]=="0":
t[m]="0"
m=m+1
if s[i]=="1":
t[m]="1"
m=m+1
p=list()
q=0
while t[q]!="3":
p.append(t[q])
q=q+1
print("".join(p)) | Traceback (most recent call last):
File "/tmp/tmpsmvqds2f/tmp21qxm19m.py", line 1, in <module>
s=list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s772540671 | p04030 | u586206420 | 1588443920 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 335 | s=list(input())
t=["3","3","3","3","3","3","3","3","3","3"]
m=0
for i in range(0, len(s)):
if s[i]=="B":
if m > 0:
t[m-1]="3"
m=m-1
if s[i]=="0":
t[m]="0"
m=m+1
if s[i]=="1":
t[m]="1"
m=m+1
p=list()
q=0
while t[q]!="3":
p.append(t[q])
q=q+1
"".join(p) | Traceback (most recent call last):
File "/tmp/tmpcsdp86oq/tmpd88bn_mb.py", line 1, in <module>
s=list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s802046465 | p04030 | u586206420 | 1588443850 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 340 | s=list(input())
t=["3","3","3","3","3","3","3","3","3","3"]
m=0
for i in range(0, len(s)):
if s[i]=="B":
if m > 0:
t[m-1]="3"
m=m-1
if s[i]=="0":
t[m]="0"
m=m+1
if s[i]=="1":
t[m]="1"
m=m+1
p=list()
q=0
while t[q]!="3":
p.append(t[q])
q=q+1
int("".join(p)) | Traceback (most recent call last):
File "/tmp/tmpttw9x7j5/tmpzwj0vcat.py", line 1, in <module>
s=list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s228810795 | p04030 | u103178403 | 1588123193 | Python | Python (3.4.3) | py | Runtime Error | 1955 | 3692 | 131 | a=input()
b=a.index
while "B" in a:
if a.startswith("B"):
a=a[1::]
elif "B" in a:
a=a[0:b("B")-1]+a[b("B")+1:]
print(a) | Traceback (most recent call last):
File "/tmp/tmpp9yvu5gg/tmpdyui9t4e.py", line 1, in <module>
a=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s865401619 | p04030 | u308918401 | 1587939169 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 139 | a=input()
ans=""
while len(a)>0:
if a[0]=="0":
ans+="0"
elif a[0]=="1":
ans+="1"
elif len(ans)>0:
ans=ans[,-1]
print(ans) | File "/tmp/tmpxdvzfwyl/tmp4f0z8d5x.py", line 9
ans=ans[,-1]
^
SyntaxError: invalid syntax
| |
s348225577 | p04030 | u642418876 | 1587684333 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 200 | s=str(input())
ans=[]
for i in range(len(s)):
if s[i]=='0':
ans.append('0')
elif s[i]=='1':
ans.append('1')
else:
if i==0:
pass
else:
del ans[i-1]
print(''.join(ans)) | Traceback (most recent call last):
File "/tmp/tmpqp1sg1yh/tmp1qj448xm.py", line 1, in <module>
s=str(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s437707067 | p04030 | u798260206 | 1587658472 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 233 | s = list(input())
answer = []
for i range s:
if i == "B":
try:
answer.pop()
except IndexError:
pass
else:
answer.append(i)
print(" ".join(answer)) | File "/tmp/tmp71s121y7/tmp0y9qkc47.py", line 4
for i range s:
^^^^^
SyntaxError: invalid syntax
| |
s758689985 | p04030 | u798260206 | 1587658386 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 222 | s = list(input())
answer = []
for i range s:
if i == "B":
try:
answer.pop()
except:
pass
else:
answer.append(i)
print(" ".join(answer)) | File "/tmp/tmpt26frcaz/tmp9vd5kaul.py", line 4
for i range s:
^^^^^
SyntaxError: invalid syntax
| |
s218233778 | p04030 | u798260206 | 1587658361 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 221 | s = list(input())
answer = []
for i range s:
if i == "B":
try:
answer.pop()
except:
pass
else:
answer.append(i)
print("".join(answer)) | File "/tmp/tmpcyzwg7mt/tmpl9ionw2v.py", line 4
for i range s:
^^^^^
SyntaxError: invalid syntax
| |
s609039707 | p04030 | u798260206 | 1587658319 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 212 | s = list(input())
answer = []
for i range s:
if i == "B":
try:
answer.pop()
except:
pass
else:
answer.append(i)
print(answer) | File "/tmp/tmpskp7dkhs/tmpl5hst9gi.py", line 4
for i range s:
^^^^^
SyntaxError: invalid syntax
| |
s613609604 | p04030 | u239653493 | 1587437369 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 127 | x=int(input())
if x>=2000:
print(1)
else:
if (x//100)*100<=x<=(x//100)*105:
print(1)
else:
print(0) | Traceback (most recent call last):
File "/tmp/tmpc6jhs8m3/tmpubvrvmb7.py", line 1, in <module>
x=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s731865692 | p04030 | u239772565 | 1587433040 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 172 | s = input()
from collections import deque
dq = deque()
for i in range(len(s)):
if s[i] == "B":
dq.pop()
continue
dq.append(s[i])
print("".join(dq))
| Traceback (most recent call last):
File "/tmp/tmp9rohnqvy/tmpqfbi15h5.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s394567094 | p04030 | u141419468 | 1587349427 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 50 | s = input()
n = s.index('B')
s.pop(n-1)
print(s) | Traceback (most recent call last):
File "/tmp/tmp7744q8yi/tmp7tg_inm1.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s211954281 | p04030 | u578854679 | 1587216226 | Python | PyPy3 (2.4.0) | py | Runtime Error | 176 | 38512 | 119 | s = input()
ans = []
for _ in s:
if _ == 'B':
ans.pop()
else:
ans.append(_)
print(*ans, sep='') | Traceback (most recent call last):
File "/tmp/tmpe_ejmkt5/tmph5sf_o38.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s234235220 | p04030 | u848667447 | 1587009533 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 208 | s = input()
a = []
for i in range(len(s)):
if s[i] == '0':
a.append('0')
elif s[i] == '1':
a.append('1')
elif s[i] == 'B':
a.pop(-1)
result = ''.join(a)
print(result)
| Traceback (most recent call last):
File "/tmp/tmp2dxx9y4p/tmpff3nakd2.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s117416982 | p04030 | u566321790 | 1586979877 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 169 | n = str(input())
ans = ''
for i in range(len(n)):
if n[i] == 'B':
ans = ans[-1]
elif n[i] == '0':
ans += '0'
elif n[i] == '1':
ans += '1'
print(ans) | Traceback (most recent call last):
File "/tmp/tmpiu4bp4_x/tmp89zqba4z.py", line 1, in <module>
n = str(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s690805666 | p04030 | u849229491 | 1586880242 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 127 | s = list(input())
ans = []
for i in s:
if i == 'B':
ans.pop()
else:
ans.append(i)
print("".join(ans)) | Traceback (most recent call last):
File "/tmp/tmpulxoltdr/tmpr6up9npr.py", line 1, in <module>
s = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s620901823 | p04030 | u057993957 | 1586669001 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 126 | s = list(input())
hoge = []
for si in s:
if si != "B":
hoge.append(si)
else:
hoge.pop()
print("".join(hoge)) | Traceback (most recent call last):
File "/tmp/tmp_e3tgmi2/tmp3oa8cnbr.py", line 1, in <module>
s = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s058453867 | p04030 | u687135117 | 1586477101 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 388 | S=list(input())
D=[]
for i in range (1,len(S)):
if S[i]=="B":
del S[i-1]
S.append("A")
for i in range (1,len(S)-1):
if S[i]=="B":
del S[i]
S.append("A")
for i in range (0,abs(len(S)-2)):
while S[i]=="B":
S.remove("B")
for i in range (0,len(S)):
if S[i]=="0" or S[i]=="1":
D.append(S[i])
D=''.join(D)
print(D) | Traceback (most recent call last):
File "/tmp/tmpgkf7wdbl/tmpc21jtxvm.py", line 1, in <module>
S=list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s958225582 | p04030 | u687135117 | 1586477050 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 278 | for i in range (1,len(S)-1):
if S[i]=="B":
del S[i]
S.append("A")
for i in range (0,abs(len(S)-2)):
while S[i]=="B":
S.remove("B")
for i in range (0,len(S)):
if S[i]=="0" or S[i]=="1":
D.append(S[i])
D=''.join(D)
print(D)
| Traceback (most recent call last):
File "/tmp/tmpeiqofznf/tmp4t1zzaeq.py", line 1, in <module>
for i in range (1,len(S)-1):
^
NameError: name 'S' is not defined
| |
s231938646 | p04030 | u687135117 | 1586476502 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 406 | S=list(input())
D=[]
for i in range (1,len(S)-1):
if S[i]=="B":
del S[i-1]
S.append("A")
for i in range (1,len(S)-1):
if S[i]=="B":
del S[i]
S.append("A")
for i in range (0,abs(len(S)-2)):
while S[i]=="B":
S.remove("B")
for i in range (0,len(S)):
if S[i]=="0" or S[i]=="1":
D.append(S[i])
D=''.join(D)
print(D) | Traceback (most recent call last):
File "/tmp/tmp_2y6ri1b/tmphko_ia92.py", line 1, in <module>
S=list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s695714158 | p04030 | u440161695 | 1586447006 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 163 | from collections import deque
s=deque(input())
A=deque()
for i in range(len(s)):
a=s.popleft()
if a=="B":
A.pop()
else:
A.append(a)
print("".join(A)) | Traceback (most recent call last):
File "/tmp/tmpxa9sxmj8/tmpu_e0jdk4.py", line 2, in <module>
s=deque(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s424368773 | p04030 | u870841038 | 1586281607 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 183 | s = input()
ans = []
x = 0
for c in s:
if c == '0' or c == '1':
ans.append(c)
else:
if len(ans) != 0:
del ans[x-1]
x += 1
print(''.join(ans)) | Traceback (most recent call last):
File "/tmp/tmpiyevli0a/tmpy39satef.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s157279097 | p04030 | u257541375 | 1586222750 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 154 | s=input()
length = len(s)
ary = []
for i in length:
if s[i] != "B":
ary.append(s[i])
elif len(ary) != 0:
ary.pop(-1)
print("".join(ary)) | Traceback (most recent call last):
File "/tmp/tmp6ze50kza/tmpf9w8rmzl.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s158114466 | p04030 | u870297120 | 1585946624 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 120 | ans = []
for i in input():
if (i == '1' or i == '0'): ans.append(i)
if i == 'B': ans.pop()
print(''.join(ans)) | Traceback (most recent call last):
File "/tmp/tmpl324gwpd/tmp0tan46d6.py", line 2, in <module>
for i in input():
^^^^^^^
EOFError: EOF when reading a line
| |
s024585220 | p04030 | u080986047 | 1585941173 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 208 | li = input()
li2 =[]
for n in li:
if n == "0":
li2.append("0")
elif n == "1":
li2.append("1")
elif n == "B":
if not len.li2 == 0:
li2.pop()
print("".join(li2))
| Traceback (most recent call last):
File "/tmp/tmp3cmdznwf/tmpf44pa7r0.py", line 1, in <module>
li = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s086119367 | p04030 | u080986047 | 1585940985 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 174 | li = input()
li2 =[]
for n in li:
if n == "0":
li2.append("0")
elif n == "1":
li2.append("1")
elif n == "B":
li2.pop()
print("".join(li2)) | Traceback (most recent call last):
File "/tmp/tmpi3dfkohz/tmpzyfxt30m.py", line 1, in <module>
li = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s700725808 | p04030 | u218838821 | 1585794589 | Python | Python (3.4.3) | py | Runtime Error | 16 | 3060 | 202 | s = list(map(str,input()))
ans = []
for i in range(len(s)):
if s[i] == '0':
ans.append('0')
elif s[i] == '1':
ans.append('1')
else:
ans.pop(-1)
print(''.join(ans)) | Traceback (most recent call last):
File "/tmp/tmp04ibj176/tmp5386k_uk.py", line 1, in <module>
s = list(map(str,input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s142879936 | p04030 | u787449825 | 1585517322 | Python | Python (3.4.3) | py | Runtime Error | 16 | 2940 | 133 | key = input()
s = []
for i in key:
if i == '0' or if i == '1':
s.append(i)
else:
if len(s) > 0:
s.pop(-1)
print(s)
| File "/tmp/tmpz8q_by2l/tmpbr8nteoc.py", line 4
if i == '0' or if i == '1':
^^
SyntaxError: invalid syntax
| |
s086265600 | p04030 | u787449825 | 1585517278 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 127 | key = input()
s = []
for i in key:
if i == '0' or i == '1':
s.append(i)
else:
len(s) > 0:
s.pop(-1)
print(s)
| File "/tmp/tmpu1kentei/tmp1cy9dfxr.py", line 7
len(s) > 0:
^
SyntaxError: invalid syntax
| |
s950654944 | p04030 | u787449825 | 1585517231 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 130 | key = input()
s = []
for i in key:
if i == '0' or if i == '1':
s.append(i)
else:
len(s) > 0:
s.pop(-1)
print(s)
| File "/tmp/tmp9fpk7ayc/tmp9ndkaal4.py", line 4
if i == '0' or if i == '1':
^^
SyntaxError: invalid syntax
| |
s940690009 | p04030 | u395816772 | 1585436592 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 185 | s = list(input())
a = s.count('B')
b = []
for i in range(len(s)):
if s[i] == 'B':
b.append(i)
b.sort(reverse=True)
for i in b:
s.pop(i)
s.pop(i-1)
print(''.join(s))
| Traceback (most recent call last):
File "/tmp/tmpwyw8qhrz/tmpj9lul_2c.py", line 1, in <module>
s = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s966172246 | p04030 | u203339404 | 1585167746 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 105 | s = input()
counter = 0
moji = ""
for i in s:
if i == "B":
moji[:-1]
continue
else:
moji+ i | File "/tmp/tmp4wrarvbm/tmpmuwb1vag.py", line 7
moji[:-1]
TabError: inconsistent use of tabs and spaces in indentation
| |
s931457697 | p04030 | u836737505 | 1585136449 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3316 | 146 | from collections import deque
s = input()
a = deque()
for i in s:
if i == "B":
a.pop()
else:
a.append(i)
print(''.join(a)) | Traceback (most recent call last):
File "/tmp/tmpn10ek577/tmpwrfs6pm0.py", line 2, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s677356090 | p04030 | u789205676 | 1585111706 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 163 | s = [i for i in input()]
for i in s:
if i == 'B':
s.remove(i)
s.remove(tmp)
tmp = i
if s[0] == 'B':
s.remove('B')
print(''.join(s)) | Traceback (most recent call last):
File "/tmp/tmpkj_q05ag/tmpr_uq6ves.py", line 1, in <module>
s = [i for i in input()]
^^^^^^^
EOFError: EOF when reading a line
| |
s252855963 | p04030 | u789205676 | 1585111317 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 163 | s = [i for i in input()]
for i in s:
if i == 'B':
s.remove(i)
s.remove(tmp)
tmp = i
if s[0] == 'B':
s.remove('B')
print("".join(s)) | Traceback (most recent call last):
File "/tmp/tmpsxqz0stj/tmpgg5pr4gq.py", line 1, in <module>
s = [i for i in input()]
^^^^^^^
EOFError: EOF when reading a line
| |
s912090933 | p04030 | u789205676 | 1585111257 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 163 | s = [i for i in input()]
for i in s:
if i == 'B':
s.remove(i)
s.remove(tmp)
tmp = i
if s[0] == 'B':
s.remove('B')
print("".join(s)) | Traceback (most recent call last):
File "/tmp/tmp0vj_1st4/tmp9pc0710r.py", line 1, in <module>
s = [i for i in input()]
^^^^^^^
EOFError: EOF when reading a line
| |
s872085490 | p04030 | u789205676 | 1585110672 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 163 | s = [i for i in input()]
for i in s:
if i == 'B':
s.remove(i)
s.remove(tmp)
tmp = i
if s[0] == 'B':
s.remove('B')
print("".join(s)) | Traceback (most recent call last):
File "/tmp/tmpuq74jnkj/tmpdvaa4xsn.py", line 1, in <module>
s = [i for i in input()]
^^^^^^^
EOFError: EOF when reading a line
| |
s314961851 | p04030 | u789205676 | 1585110475 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 164 | s = [i for i in input()]
for i in s:
if i == 'B':
s.remove(i)
s.remove(tmp)
tmp = i
if s[0] == 'B':
s.remove('B')
print("".join(s))
| Traceback (most recent call last):
File "/tmp/tmp9sbjfx7t/tmpm0xbak7q.py", line 1, in <module>
s = [i for i in input()]
^^^^^^^
EOFError: EOF when reading a line
| |
s824789567 | p04030 | u288430479 | 1584456449 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 185 | s=list(input())
print(s)
l=len(s)
data =[]
for i in s:
if i=="0":
data.append(0)
elif i=="1":
data.append(1)
else:
if data!=[]:
del data[-1]
print("".join(data)) | Traceback (most recent call last):
File "/tmp/tmpc_7dgq0k/tmps16q2b_r.py", line 1, in <module>
s=list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s280865469 | p04030 | u223663729 | 1584310952 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 110 | s = input()
ans = ''
for i in s:
if i == 'B':
ans = ans[:-1]
else
ans += i
print(ans) | File "/tmp/tmpqlhx8g9_/tmp9pz3rwmz.py", line 7
else
^
SyntaxError: expected ':'
| |
s345866781 | p04030 | u163874353 | 1584120659 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 244 | s = input()
l =[]
for i in range(len(s)):
if s[i] == "0":
l.append("0")
elif s[i] == "1":
l.append("1")
elif s[i] =="B":
if len(l) == 0:
pass
else:
del l[i - 1]
print("".join(l)) | Traceback (most recent call last):
File "/tmp/tmpjxa65s6_/tmp0we_oof9.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s574023769 | p04030 | u066855390 | 1583984879 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 188 | S = list(input())
stack = []
stack.append(S.pop(0))
for s in S:
if s == "B":
if len(stack) > 0:
stack.pop()
else:
stack.append(s)
print("".join(stack) | File "/tmp/tmpzm00j_ns/tmp46gjrbk5.py", line 12
print("".join(stack)
^
SyntaxError: '(' was never closed
| |
s880790252 | p04030 | u000123984 | 1583785669 | Python | Python (3.4.3) | py | Runtime Error | 19 | 2940 | 129 | li = list(str(input()))
for i in range(li):
if(li[i] == "B" and not i == 0):
li[i-1] = ""
li[i] = ""
print("".join(li)) | Traceback (most recent call last):
File "/tmp/tmpw42bzncr/tmpe7_0m1s7.py", line 1, in <module>
li = list(str(input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s058230295 | p04030 | u000123984 | 1583785566 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 127 | li = list(str(input()))
for i in len(li):
if(li[i] == "B" and not i == 0):
li[i-1] = ""
li[i] = ""
print("".join(li)) | Traceback (most recent call last):
File "/tmp/tmpmbceyknn/tmp700ypdf4.py", line 1, in <module>
li = list(str(input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s431012253 | p04030 | u000123984 | 1583785429 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 133 | li = list(map(str, input()))
for i in len(li):
if(not i == 0 and li[i] == "B"):
li[i-1] = ""
li[i] = ""
print("".join(li)) | Traceback (most recent call last):
File "/tmp/tmpy3z9nzci/tmpp5c4l55g.py", line 1, in <module>
li = list(map(str, input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s872442529 | p04030 | u000123984 | 1583785363 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 123 | li = list(input())
for i in len(li):
if(not i == 0 and li[i] == "B"):
li[i-1] = ""
li[i] = ""
print("".join(li)) | Traceback (most recent call last):
File "/tmp/tmp1mxkhum_/tmpimtxxwqn.py", line 1, in <module>
li = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s162389110 | p04030 | u000123984 | 1583284487 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 158 | li = list(input())
for i in range(len(li)):
if li[i]=="B": li[i-1]==""
else:
for j in len(li):
if li[j]=="B": li[j]==""
else:
print("".join(li)) | Traceback (most recent call last):
File "/tmp/tmp3jncefep/tmpaq4ju0pd.py", line 1, in <module>
li = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s145609061 | p04030 | u263824932 | 1583268814 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 297 | S=input()
words=[*S]
answers=[]
for n in words:
if n=='1':
answers.append('1')
elif n=='0':
answers.append('0')
else:
if not answers:
continue
else:
answers.pop()
mojiretu=''
for x in answers:
mojiretu+=x
print(int(mojiretu)) | Traceback (most recent call last):
File "/tmp/tmpjlli56z8/tmp1hs6n69_.py", line 1, in <module>
S=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s771896720 | p04030 | u263824932 | 1583268697 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 293 | S=input()
words=[*S]
answers=[]
for n in words:
if n=='1':
answers.append('1')
elif n=='0':
answers.append('0')
else:
if not answers:
continue
else:
answers.pop()
mojiretu=''
for x in answers:
mojiretu+=x
print(mojiretu)
| Traceback (most recent call last):
File "/tmp/tmpw4_3w_0j/tmpccz385an.py", line 1, in <module>
S=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s547576064 | p04030 | u263824932 | 1583268654 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 293 | S=input()
words=[*S]
answers=[]
for n in words:
if n=='1':
answers.append('1')
elif n=='0':
answers.append('0')
else:
if not answers:
continue
else:
answers.pop()
mojiretu=''
for x in answers:
mojiretu+=x
print(mojiretu)
| Traceback (most recent call last):
File "/tmp/tmpkpyhkmpu/tmpl8c90vyc.py", line 1, in <module>
S=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s926390952 | p04030 | u693933222 | 1582692745 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 149 | s = list(input())
ans = []
for i in s:
if(i == "B"):
ans.pop(-1)
else:
ans+=i
for i in ans:
print(i, end="")
print("") | Traceback (most recent call last):
File "/tmp/tmpu4h6ahnu/tmpt8r_58sk.py", line 1, in <module>
s = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s022553983 | p04030 | u223663729 | 1582683770 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 143 | s = str(input()).split('')
text = ''
for i in s:
if i == 'B' and len(text) > 0:
text = text[:-1]
else:
text += i
print(text) | Traceback (most recent call last):
File "/tmp/tmpf4rpuh8s/tmpaq6xk0av.py", line 1, in <module>
s = str(input()).split('')
^^^^^^^
EOFError: EOF when reading a line
| |
s237488937 | p04030 | u208309047 | 1582404246 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 170 | C = []
A = input()
for i in A:
if i == '0':
C.append(i)
if i == '1':
C.append(i)
if i == 'B' and len(C)!=0:
C.pop()
print("".join(C) | File "/tmp/tmpz05yrf7g/tmpus_n_p13.py", line 11
print("".join(C)
^
SyntaxError: '(' was never closed
| |
s199928425 | p04030 | u208309047 | 1582325794 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 147 | C = []
A = input()
for i in A:
if i == '0':
C.append(i)
if i == '1':
C.append(i)
if i == 'B':
C.pop()
print(C) | Traceback (most recent call last):
File "/tmp/tmpeo8o7xf2/tmp25dlfnn7.py", line 2, in <module>
A = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s550281507 | p04030 | u408375121 | 1582247841 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 133 | s = input()
l = []
for t in s:
if t == '0' or t == '1':
l.append(t)
elif t == 'B':
l.pop()
for r in l:
print(r, end='') | Traceback (most recent call last):
File "/tmp/tmpj7q05pha/tmpuafvaajc.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s490815413 | p04030 | u408375121 | 1582247225 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 120 | s = input()
c = ''
for t in s:
if t == '0' or t == '1':
c += t
if t == 'B' and c != '':
c -= c[-1]
print(c)
| Traceback (most recent call last):
File "/tmp/tmpfry65_66/tmpazilh0c8.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s648084683 | p04030 | u408375121 | 1582246751 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 140 | s = input()
c = ''
for t in s:
if t == '0' or t == '1':
c += t
elif t == 'B':
if c != '':
k = c[-1]
c -= k
print(c)
| Traceback (most recent call last):
File "/tmp/tmp89a868vo/tmpdxizbxj7.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.