diff --git a/include/lzw.h b/include/lzw.h
index a878020ffee47ca76b215fde4799894d3cc52fd4..e45e61474a3271a65ef36ba6c06f278e54ff6995 100644
--- a/include/lzw.h
+++ b/include/lzw.h
@@ -3,6 +3,6 @@
 
 class LZW{
 	public:
-		string pack(string &input);
+		int* pack(string &input);
 		string unpack(int input[]);
 };
\ No newline at end of file
diff --git a/src/lzw.cpp b/src/lzw.cpp
index 417754059092908baf42cddbdf568a8ea64b09af..885f21b495718afca87c53e7819436b9540e406d 100644
--- a/src/lzw.cpp
+++ b/src/lzw.cpp
@@ -5,11 +5,13 @@
 using namespace std;
 
 
-string LZW::pack(string &input){
+int* LZW::pack(string &input){
 	map<string, int> dictionary;
 	string output = "";
 	string nextChar, currentChar = "";
-	int i, cont=0, dictionarySize = 256;
+	int i, temp, n, lastI, cont=0, dictionarySize = 256;
+	int *intOutput;
+	intOutput = new int[dictionarySize-1];
 
 	//inicializa o dicionĂ¡rio
 	for(i = 0; i < 256; i++){
@@ -31,25 +33,25 @@ string LZW::pack(string &input){
 	output += dictionary[currentChar] + " ";
 	cont++;
 
-	/* CONVERSAO
-	int *intOutput;
-	int temp = n = 0;
-	intOutput = new int[dictionarySize-1];
+	// --------------------- CONVERSAO --------------------------
 
-	for(i = 0; i < cont; i++){
-		if(output[i] != " "){
+	do{
+		if(output[i] != ' ' && output[i] != '\0'){
 			temp++;
 		} else {
-			for (j = temp-1; j >= 0; j--){
-				intOutput[n] += output[j] * pow(10,j);
+			for (j = lastI; j < i; j++){
+				intOutput[n] += (output[j] - '0') * pow(10,temp-1);
+				temp--;
 			}
 			n++;
-			temp = 0;
+			lastI = i+1;
 		}
-	}
-	*/
+		i++;
+	}while (output[i-1] != '\0');
+
+	//-----------------------------------------------------------
 
-	return intOutput;
+	return &intOutput;
 }
 
 string LZW::unpack(int input[]){