fork(2) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. const int arrayElements = 5;
  6.  
  7. int main()
  8. {
  9. int lineInputs = 0;
  10.  
  11. cin >> lineInputs;
  12.  
  13. int total = arrayElements*lineInputs;
  14.  
  15. char myArray[arrayElements*lineInputs];
  16. //cout << arrayElements*lineInputs;
  17. int whatever = 0;
  18. //FILL ARRAY
  19. for(int i = 0; i < lineInputs; i++)
  20. {
  21. cin >> whatever;
  22. for(int j=0; j<arrayElements; j++)
  23. {
  24. //cout << j << " ";
  25. cin >> myArray[i];
  26. }
  27. }
  28. // READ AND CHECK FOR COMBINATIONS
  29.  
  30. for(int k = 0; k < lineInputs; k++)
  31. {
  32. int counter=0;
  33. cout << (k+1) << " ";
  34.  
  35. for(int u=0; u<arrayElements; u++)
  36. {
  37. //cout << myArray[u];
  38. if(myArray[u] == 'T' && myArray[u+1] == 'T' && myArray[u+2] == 'T')
  39. {
  40. counter++;
  41. cout << counter << " ";
  42. }
  43. }
  44. }
  45.  
  46.  
  47. return 0;
  48. }
  49.  
  50.  
  51.  
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
Standard output is empty