Mutations

  • + 0 comments

    I passed all test cases on submiting or running the code for a few seconds and then it fails reverting with a Runtime Error: Traceback (most recent call last): File "/tmp/submission/20250121/02/01/hackerrank-fcae3a6b8a4ebd2191a0a3e1614f0f2d/code/Solution.py", line 11, in s = input() ^^^^^^^ EOFError: EOF when reading a line

    I tried catching the error but it still fails. Any Solutions?

    This is the code: def mutate_string(string, position, character): return string[:position] + character + string[position + 1:]

    if name == 'main': try: s = input().strip() i, c = input().split() s_new = mutate_string(s, int(i), c) print(s_new) except EOFError: pass