For this Question: Given a string, the task is to remove duplicates from it. Expected time complexity O(n) where n is length of the input string and extra space O(1) under the assumption that there are total of 256 possible characters in a string.

Note: that original order of characters must be kept same.The first line of the input is the number of test cases T. And the first line of a test case contains a string.

Constraints: 
1 <= T <= 15
1 <= |string|<= 15000Modified string without duplicates and the same order of characters.Input:
2
hello
helloworld

Output:
helo
helowrd, I have written this Solution Code: // C++ implementation of above approach 
#include <bits/stdc++.h> 
#include <string> 
using namespace std; 

// Function to remove duplicates 
string removeDuplicatesFromString(string str) 
{ 

	// keeps track of visited characters 
	int counter = 0; 

	int i = 0; 
	int size = str.size(); 

	// gets character value 
	int x; 

	// keeps track of length of resultant string 
	int length = 0; 
     int table[500];
     memset(table,0,sizeof(table));
	while (i < size) { 
		x = str[i]-'a'+97; 
          
		// check if Xth bit of counter is unset 
		if (table[x] == 0) { 

			str[length] = 'a' + x -97; 

			// mark current character as visited 
			table[x]++;

			length++; 
		} 
		i++; 
	} 

	return str.substr(0, length); 
} 

// Driver code 
int main() 
{  

	int t;
	cin>>t;
	while(t>0)
	{ t--;
		string str;
		cin>>str;
	cout << removeDuplicatesFromString(str)<<"\n"; 
	 

   }
} 
, In this Programming Language: C++, Now tell me if this Code is compilable or not?