/* -*- coding: utf-8 -*- * * 2226.cc: No.2226 Hello, Forgotten World! - yukicoder */ #include #include #include using namespace std; /* constant */ const int MAX_N = 1000; const int L = 10; const char T[] = "helloworld"; /* typedef */ /* global variables */ char s[MAX_N + 4], t[MAX_N + 4], mins[MAX_N + 4]; /* subroutines */ bool match(char w[]) { for (int i = 0; i < L; i++) if (w[i] != '?' && w[i] != T[i]) return false; return true; } /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { int n; scanf("%d%s", &n, s); bool found = false; mins[0] = 'z' + 1, mins[1] = '\0'; for (int k = n - L; k >= 0; k--) if (match(s + k)) { found = true; strcpy(t, s); for (int i = 0; i < L; i++) t[k + i] = T[i]; for (int i = 0; i < n; i++) if (t[i] == '?') t[i] = 'a'; if (strcmp(mins, t) > 0) strcpy(mins, t); } if (found) puts(mins); else puts("-1"); } return 0; }