← Back to List

10501번: Ragged Right ↗

Solutions

Python 3
171 B | 171 chars
ans = 0
l = []
mx = 0

while 1:
  try:
    s = input()
  except:
    break
  l.append(len(s))
  mx = max(mx, len(s))
  
for i in l[:-1]:
  ans += (mx - i) ** 2

print(ans)