Ankit_132

A

Dec 6th, 2023
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1.  
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. #define _test int _TEST; cin>>_TEST; while(_TEST--)
  7.  
  8.  
  9. int main()
  10. {
  11. _test
  12. {
  13. string s;
  14. cin>>s;
  15.  
  16. set<string> ans;
  17.  
  18. string x, y;
  19. x = s, y = s;
  20.  
  21. for(char c='a'; c<='h'; c++)
  22. {
  23. x[0] = c;
  24. ans.insert(x);
  25. }
  26.  
  27. for(char c='1'; c<='8'; c++)
  28. {
  29. y[1] = c;
  30. ans.insert(y);
  31. }
  32.  
  33. ans.erase(s);
  34.  
  35. for(auto e: ans)
  36. cout<<e<<"\n";
  37. cout<<"\n";
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment