fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. void solve()
  5. {
  6. int n, k;
  7. cin >> n >> k;
  8.  
  9. string s = "";
  10.  
  11. for(int i = 0; i < k; i++)
  12. s.push_back('a' + i);
  13.  
  14. for(int i = 0; i < n; i++)
  15. cout << s;
  16.  
  17. cout << endl;
  18. }
  19.  
  20. int main() {
  21. // your code goes here
  22. int t;
  23. cin >> t;
  24.  
  25. while(t--)
  26. solve();
  27. }
Success #stdin #stdout 0s 5304KB
stdin
4
1 2
2 1
2 2
2 3
stdout
ab
aa
abab
abcabc