String comparison for n characters