TOPIC

WA 5% pq??

João Rafael asked 1 year ago

dic = {}
a, b = map(int, input().split())
z = []
for i in range(a):
  x = input().split()
  tam = 0
  if x[0][0].lower() not in dic:
    dic[x[0][0].lower()] = len(z)
    for j in range(len(x)):
      tam += len(x[j])
    z.append(tam)  
  else:
    for j in range(len(x)):
      tam += len(x[j])   
    if tam > z[dic[x[0][0].lower()]]:
      z[dic[x[0][0].lower()]] = tam
z.sort()
soma = 0
for i in range(len(z)-1, len(z)-b-1, -1):
  soma += z[i]
print(soma)        

Remember not post solutions. Your post may be reviewed by our moderators.

  • bruno belloni replied 1 year ago

    me explica a questao brother dsuahsuahsdua, não entendi o significado do dia do mês. tem que comparar com a string completa? ou com o split dela?