Use python.
import string lineas = [l.strip() for l in open('beautiful_stringstxt.txt')] cont = lineas[0] out = '' tabla = string.maketrans("","") for x in range(1, int(cont) +1): l = lineas[x].lower() l = l.translate(tabla, string.punctuation) l = l.replace(' ', '') set_l = set(l) lista = [] for e in set_l: lista.append(l.count(e)) lista.sort(reverse=True) a = 26 z = 0 for e in lista: z += a * e a -= 1 out += 'Case #' + str(x) + ': ' + str(z) + '\n' with open('output', 'w') as f: f.write(out)
No hay comentarios:
Publicar un comentario