Index error:
Execution failed.
IndexError: list index out of range
Stack Trace:
Traceback (most recent call last):
File "/tmp/146373551/user_code.py", line 8, in
if i == 0 and s[0] == s[i_1]:
IndexError: list index out of range
on the line marked with #error
tc = int(input())
for tc_ct in range(tc):
s = input().split()
n = len(s)
edited_s = s.copy()
for i in range(n):
i_1 = i+1
if i == 0 and s[0] == s[i_1]: #error
edited_s.pop(i)
elif i == n-1:
if s[i] == s[i-1]:
edited_s.pop(i)
else:
if s[i] == s[i-1] or s[i] == s[i+1]:
edited_s.pop(i)
print("".join(edited_s))
Please help!! Respond in 10 minutes for brainliest!!!
Answers
Answered by
0
Answer:
eeroe
ok input output
Similar questions
Science,
2 months ago
Science,
2 months ago
Computer Science,
5 months ago
Hindi,
10 months ago
Hindi,
10 months ago