fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <cstdio>
  4. using namespace std;
  5.  
  6. int c;
  7. string napis;
  8.  
  9. int main()
  10. {
  11. cin>>c;
  12. while (c--)
  13. {
  14. cin>>napis;
  15. for(int i=1; i<=napis.length(); i++)
  16. {
  17. int k=0;
  18. while(napis[i]==napis[i-1])
  19. {
  20. k++;
  21. i++;
  22. }
  23. if (k>=2)
  24. {
  25. cout<<napis[i-1]<<k+1;
  26. }
  27. }
  28. cout<<endl;
  29. }
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0s 15240KB
stdin
2
aabbbbccccccccdd
aaaabbbbbbccdddddddcc
stdout
b4c8
a4b6d7