#include <iostream>
#include <cctype>
using namespace std ;
int main() {
string s;
int freqs[26] = { 0 };
getline( cin, s );
for (auto c : s) {
if (isalpha(c)) {
freqs[toupper(c) - 'A'] += 1;
}
}
int max = 0;
string out = "";
for (int i = 0; i < 26; i++) {
if (freqs[i] == max) {
out.push_back((char)'A' + i);
} else if (freqs[i] > max) {
out = "";
out.push_back((char)'A' + i);
max = freqs[i];
}
}
cout << out << endl;
cout << max;
return 0;
}
Объяснение:
удачки с сириусом мужик)
#include <iostream>
#include <cctype>
using namespace std ;
int main() {
string s;
int freqs[26] = { 0 };
getline( cin, s );
for (auto c : s) {
if (isalpha(c)) {
freqs[toupper(c) - 'A'] += 1;
}
}
int max = 0;
string out = "";
for (int i = 0; i < 26; i++) {
if (freqs[i] == max) {
out.push_back((char)'A' + i);
} else if (freqs[i] > max) {
out = "";
out.push_back((char)'A' + i);
max = freqs[i];
}
}
cout << out << endl;
cout << max;
return 0;
}
Объяснение:
удачки с сириусом мужик)
k = 7
m = 6
n = 5
if m < k: заходим сюда
if k < n:
print(m, k, n)
else: заходим сюда
print(m, n, k) выполняем и заканчиваем работу
elif k < m:
if m < n:
print(k, m, n)
else:
print(k, n, m)
A)6 5 7
B)5 6 7
C)7 5 6
D)6 7 5