Advertisement
codegod313

bukavi

Nov 6th, 2019
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. // laba4_2
  2. // Fedorinchik Elvina
  3.  
  4. #include "pch.h"
  5. #define _CRT_SECURE_NO_WARNINGS
  6. #include <stdio.h>
  7. #include <locale.h>
  8. #include <iostream>
  9. #include <vector>
  10. #include <cstdlib>
  11. #include <string>
  12.  
  13.  
  14. using namespace std;
  15.  
  16.  
  17.  
  18. int main()
  19. {
  20.     int a[26];
  21.     for (int i = 0; i < 26; i++) {
  22.         a[i] = 0;
  23.     }
  24.     char *s = (char *)malloc(256 * sizeof(char));
  25.     scanf("%s", s);
  26.     for (int i = 0; i < strlen(s); i++) {
  27.         a[s[i] - 'a']++;
  28.     }
  29.     cout << endl;
  30.     for (int i = 0; i < 26; i++) {
  31.         cout << (char)((int)i + 'a') << " ";
  32.     }
  33.     cout << endl;
  34.     for (int i = 0; i < 26; i++) {
  35.         cout << a[i] << " ";
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement