public static char[] solve(char[] s) {
		char[] relt = new char[s.length];
		int index = 0;
		int start = 0;
		int end = s.length - 1;

		while (start <= end) {
			if (s[start] < s[end]) {
				relt[index++] = s[start++];
			} else if (s[start] > s[end]) {
				relt[index++] = s[end--];
			} else {
				int i, j;
				for (i = start, j = end; i <= j; i++, j--) {
					if (s[i] < s[j]) {
						relt[index++] = s[start++];
						break;
					} else if (s[i] > s[j]) {
						relt[index++] = s[end--];
						break;
					}
				}
				if (i > j) {
					relt[index++] = s[start++];
				}
			}
		}

		return relt;
	}