Find S Algorithm Using Python With Javascript