BRS cohomology in topological string theory and integrable systems