implementacao do diff