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: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int test = Integer.parseInt(br.readLine());

		while(test-->0)
		{
		String line=br.readLine();
        char str[] = line.toCharArray();
        int n = str.length;
        System.out.println(duplicates(str, n));
		}
	}

	 static String duplicates(char str[], int n)
    {
        int index = 0;

        for (int i = 0; i < n; i++)
        {
            int j;

            for (j = 0; j < i; j++)
                if (str[i] == str[j])
                    break;

            if (j == i)
                str[index++] = str[i];
        }
        return String.valueOf(Arrays.copyOf(str, index));
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?