fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. long int T,t,n,a,x,b;
  8. string str1,str2;
  9. cin >> T;
  10. for (t=1; t<=T; t++)
  11. {
  12. cin >> n;
  13. n--;
  14. cin >> str1;
  15. a = str1.length();
  16. b = 0;
  17. for (x=0; x<a; x++)
  18. {
  19. if (x != n)
  20. {
  21. str2[b] = str1[x];
  22. b++;
  23. }
  24. }
  25. cout << t << " ";
  26. for (b=0; b < a-1; b++)
  27. {
  28. cout << str2[b];
  29. }
  30. cout << "\n";
  31. }
  32. }
Success #stdin #stdout 0s 4188KB
stdin
4
4 MISSPELL
1 PROGRAMMING
7 CONTEST
3 BALLOON
stdout
1 MISPELL
2 ROGRAMMING
3 CONTES
4 BALOON