← run

lcb-0067

1.000
3/3 tests· algorithms

Proposed solution

```python
def solution(s):
    n = len(s)
    for i in range(n):
        if s[i:] == s[i:][::-1]:
            return s + s[:i][::-1]

if __name__ == "__main__":
    import sys
    s = sys.stdin.readline().strip()
    print(solution(s))
```

Test output (stdout)

...                                                                      [100%]
3 passed in 0.05s
System prompt
You are an expert programmer. Solve the task exactly as specified. Output your solution as fenced code blocks using the required file name(s) and the exact function/type signatures requested. Prefer correctness; do not include prose outside code unless asked.