<commit_before>c,s,w=[],"",readlines[1..-1].map{|x|x.chop}.sort
while w.size>0
x=w[0]
w=w[1..-1]
y=x.reverse
n=w.find_index y
if n.nil?
c+=[x] if x==y
else
s+=x
w.delete_at n
end
end
puts s+(c.size>0?c.sort[0]:"")+s.reverse<commit_msg>Update answer4.rb<commit_after>c,s,w=[],"",readlines[1..-1].map{|x|x.chop}.sort
while w.size>0
x=w[0]
w,y=w[1..-1],x.reverse
n=w.find_index y
if n.nil?
c+=[x]if x==y
else
s+=x
w.delete_at n
end
end
puts s+(c.size>0?c.sort[0]:"")+s.reverse
{'fraction_non_alphanumeric': 0.2748414376321353, 'fraction_numerical': 0.035940803382663845, 'mean_word_length': 5.32, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '189533', 'n_tokens_mistral': 266, 'n_tokens_neox': 263, 'n_words': 40}