diff --git a/src/lzw.cpp b/src/lzw.cpp
index c3ca61d2b074f2360ca14757bf5b93773e34c493..a86dad263fe471f42fe4ed4d8b42f14bd0276e51 100644
--- a/src/lzw.cpp
+++ b/src/lzw.cpp
@@ -6,11 +6,11 @@
 using namespace std;
 
 
-void pack(string input, int* intOutput){
+void pack(string input, int* novo_output){
 	map<string, int> dictionary;
-	string output = "";
+	// int *output = NULL;
 	string nextChar, currentChar = "";
-	int i, j, temp, n = 0, size, lastI, cont=0, dictionarySize = 256;
+	int i, size, cont=0, dictionarySize = 256;
 
 	//inicializa o dicionĂ¡rio
 	for(i = 0; i < 256; i++){
@@ -20,40 +20,44 @@ void pack(string input, int* intOutput){
 	size = input.size();
 	for(i = 0; i < size; i++){
 		nextChar = input[i];
+cout << "next char = " << nextChar << endl;
 		if(dictionary[currentChar + nextChar] != 0){
 			currentChar = currentChar + nextChar;
+cout << "current char = " << currentChar << endl;
 		}else{
-			output += dictionary[currentChar] + " ";
-cout << dictionary[currentChar] << endl;
-cout << output << endl;
+			novo_output = (int*) realloc (novo_output, sizeof(int));
+cout << "dict = " << dictionary[currentChar] << endl;
+			novo_output[cont] = dictionary[currentChar];
+cout << "novo_output = " << novo_output[cont] << endl;
 			dictionary[currentChar+nextChar] = dictionarySize;
 			currentChar = nextChar;
 			dictionarySize++;
 			cont++;
+			// output = novo_output;
 		}
-//cout << output << endl;
+// cout << output << endl;
 	}
-	output += dictionary[currentChar] + " ";
-	cont++;
+	// output += dictionary[currentChar] + " ";
+	// cont++;
 
 	// --------------------- CONVERSAO --------------------------
 
-	intOutput = new int[dictionarySize-1];
-	do{
-		if(output[i] != ' ' && output[i] != '\0'){
-			temp++;
-		} else {
-			for (j = lastI; j < i; j++){
-				intOutput[n] += (output[j] - '0') * pow(10,temp-1);
-				temp--;
-			}
-			n++;
-			lastI = i+1;
-		}
-		i++;
-	}while (output[i-1] != '\0');
+	// intOutput = new int[dictionarySize-1];
+	// do{
+	// 	if(output[i] != ' ' && output[i] != '\0'){
+	// 		temp++;
+	// 	} else {
+	// 		for (j = lastI; j < i; j++){
+	// 			intOutput[n] += (output[j] - '0') * pow(10,temp-1);
+	// 			temp--;
+	// 		}
+	// 		n++;
+	// 		lastI = i+1;
+	// 	}
+	// 	i++;
+	// }while (output[i-1] != '\0');
 
-cout << intOutput << endl;
+// cout << intOutput << endl;
 
 	//-----------------------------------------------------------
 }
@@ -90,4 +94,4 @@ string unpack(int* input){
 		}
 	}
 	return output;
-}
\ No newline at end of file
+}