#https://algospot.com/judge/problem/read/DECUAL
testcount = int(input())
inputList = [input() for y in range(testcount*2)]
def isNumber(s):
try:
float(s)
return True
except ValueError:
return False
def decrypt(inputstring) :
size = len(inputstring)
returnList = ""
i = 0
while i < size :
if inputstring[i] == '(' :
end = i
while inputstring[end+1] != ')':
end = end + 1
#list[i+1:end+1]까지 해야함. end+2의 위치엔 항상 ^가 있으니 바로 3으로 간다. end+3 부터는 숫자일 것이다.
times = 0
j = end + 3
print(j)
**while isNumber(inputstring[j]) and j < size:**
j = j+1
print(j)
timeString = inputstring[end+3:j]
length = len(timeString)
for x in range(length) :
k = int(timeString[x])
times = times + k*10**x
i = j
for k in range(times) :
returnList = returnList + returnList[i+1:end+1]
else :
returnList = returnList + str(inputstring[i])
i = i+1
return returnList
for test in range(testcount) :
inputString1 = str(inputList[2*test])
inputString2 = str(inputList[2*test+1])
if decrypt(inputString1) == decrypt(inputString2) :
print("YES")
else :
print("NO")
문제를 풀고 있는 데 while isNumber 부분에서 오류가 있습니다. String index out of range. 근데 제 실력으로는 왜 이 오류가 일어나는지 이해가 안가서요.(j값이 문자열 길이보다 크지는 않을 것 같은데) 오류가 일어나는 부분은 기호 이후로 나오는 숫자를 감지해서 기록하기 위한 부분입니다.
imes
문제를 풀고 있는 데 while isNumber 부분에서 오류가 있습니다. String index out of range. 근데 제 실력으로는 왜 이 오류가 일어나는지 이해가 안가서요.(j값이 문자열 길이보다 크지는 않을 것 같은데) 오류가 일어나는 부분은 기호 이후로 나오는 숫자를 감지해서 기록하기 위한 부분입니다.
9년 전