fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n; string sa[10009], sz[10009], x;
  4. int main() {
  5. cin >> n;
  6. for(int i = 0; i < n; i++) {
  7. cin >> x;
  8. for(int j = 0; j < x.size(); j++) {
  9. sa[i] += (x[j] != '?' ? x[j] : 'a');
  10. sz[i] += (x[j] != '?' ? x[j] : 'z');
  11. }
  12. }
  13. cin >> x;
  14. int l = 0, r = 0;
  15. for(int i = 0; i < n; i++) {
  16. if(x > sz[i]) l++;
  17. else if(x >= sa[i]) r++;
  18. }
  19. //cout << l << ' ' << r << endl;
  20. for(int i = l; i <= l + r; i++) {
  21. if(i != l) cout << ' ';
  22. cout << i + 1;
  23. }
  24. cout << endl;
  25. return 0;
  26. }
Success #stdin #stdout 0s 15864KB
stdin
7
??i?
?o???g????
??m??x?
?h?????i
s????
?og????
u??
square
stdout
1 2 3 4 5 6 7