def caesar_cipher(str, key)
	str1 = str.split(//)
	str1.map! do |ch|
		if (/\w/.match(ch))	
			key.times do
				if (/^[zZ]/.match(ch))
					ch.next!
				elsif (/z/.match(ch))
					ch = "a"
				else
					ch = "A"
				end
			end
		end
	end
	str1.join
end

puts caesar_cipher("What a string!", 4)