fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;
  6. cin >> t;
  7. int cs[25], cb[25];
  8. for (int j = 0; j < 25; j++) {
  9. cs[j] = 0;
  10. cb[j] = 0;
  11. }
  12.  
  13. for (int i = 0; i < t+1; i++) {
  14. string tekst;
  15. getline(cin, tekst);
  16.  
  17. for (int k = 0; tekst[k] != '\0'; k++) {
  18. if ((int)tekst[k] != 32) {
  19. if ((int)tekst[k] > 64 && (int)tekst[k] < 91) {
  20. cb[(int)tekst[k] - 65]++;
  21. }
  22. else if((int)tekst[k]> 96 && (int)tekst[k]< 123) {
  23. cs[(int)tekst[k] - 97]++;
  24. }
  25. }
  26. }
  27. }
  28.  
  29. for (int j = 0; j < 25; j++) {
  30. if (cs[j] != 0) {
  31. cout << (char)(j + 97) << " " << cs[j]<<endl;
  32. }
  33. }
  34.  
  35. for (int j = 0; j < 25; j++) {
  36. if (cb[j] != 0) {
  37. cout << (char)(j + 65) << " " << cb[j]<<endl;
  38. }
  39. }
  40. return 0;
  41. }
Success #stdin #stdout 0.01s 5432KB
stdin
Standard input is empty
stdout
Standard output is empty