Gauge invariant local action of string field from BRS formalism