daily pastebin goal
27%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #include "pch.h"
  3. #include <iostream>
  4. #include <string>
  5. #include <cstring>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     string str = "this is one test string!";
  11.     char bukvi[] = { 'e','t','i','o' };
  12.     int sz = str.size();
  13.  
  14.  
  15.     for (int i = 0; i < 4; i++) {
  16.         int cnt = 0, max = 0, temp = 0;
  17.         for (int j = 0; j < sz; j++) {
  18.             if (str[j] == bukvi[i]) {
  19.  
  20.                 cnt++;
  21.             }
  22.         }
  23.         if (max < cnt) {
  24.             temp = max;
  25.             max = cnt;
  26.             cnt = 0;
  27.             if (max > temp) {
  28.                 cout << bukvi[i] << " is the most common letter. It is repeated " << max << " times.\n";
  29.             }
  30.         }
  31.  
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top