Advertisement
Farjana_akter

Untitled

Mar 17th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long int ll;
  4. string s[200],res[200],rule;
  5. ll n;
  6.  
  7.  
  8. void pass(ll pos)
  9. {
  10. if(pos==rule.size())
  11. {
  12. for(int i=0;i<pos;i++)
  13. cout<<res[i];
  14. cout<<endl;
  15. return ;
  16. }
  17. else if(rule[pos]=='#')
  18. {
  19. for(int i=0;i<n;i++)
  20. {
  21. res[pos]=s[i];
  22. pass(pos+1);
  23. }
  24. }
  25. else
  26. {
  27. for(int i=0;i<10;i++)
  28. {
  29. res[pos]=i+'0';
  30. pass(pos+1);
  31. }
  32. }
  33. }
  34.  
  35. int main()
  36. {
  37. ll i,j,k,com,a,b,c,d,e;
  38. while(cin>>n)
  39. {
  40. for(i=0;i<n;i++)
  41. cin>>s[i];
  42. cin>>com;
  43. cout<<"--"<<endl;
  44. while(com--)
  45. {
  46. cin>>rule;
  47. pass(0);
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement