Beginner in need of Help: A. Way Too Long Words

Revision en1, by parkershamblin, 2020-06-23 09:08:54

Hi, this is my first day on Codeforces and I'm currently struggling to get started. Here is the link to the problem I am trying to solve: https://codeforces.com/problemset/problem/71/A

I am not sure why my submission keeps failing on test 1.

lines = input()
lines = lines.splitlines()
n = int(lines[0])

for word in lines[1:n+1]:
    if len(word) > 10:
        abrv = f"{word[0]}{len(word[1:-1])}{word[-1]}"
        print(abrv)
    else:
        print(word)

Does anyone have any ideas?

Thanks, Parker.

Tags #help, #beginner, #python 3

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English parkershamblin 2020-06-23 09:08:54 584 Initial revision (published)