File.open('encrypt.txt', 'r') do |f1|
n=0
while line = f1.gets
text=line
end
text2=text.split(",")
text3=Array.new
while n<text2.length
text3[n]=text2[n].to_i
n=n+1
end
n=0
text4=Array.new
while n<text2.length
text4[n]=text3[n] - ((n*n*n)+(n*n)+n+text2.length)
n=n+1
end
n=0
text5=Array.new
while n<text2.length
text5[n]=text4[n].chr
n=n+1
end
text6=text5.join
File.open('decrypt.txt', 'w') do |f2|
f2.puts text6
end
end