Precreation contest files
This commit is contained in:
30
misc/chuyen-de-xau/b7.cpp
Normal file
30
misc/chuyen-de-xau/b7.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
int counter[(int)('z' - 'a')];
|
||||
|
||||
int main() {
|
||||
ios_base::sync_with_stdio(false);
|
||||
cin.tie(NULL);
|
||||
|
||||
string a;
|
||||
cin >> a;
|
||||
for (const auto i : a) {
|
||||
counter[i - 'a']++;
|
||||
}
|
||||
|
||||
int sum = 0;
|
||||
for (const auto i : counter) {
|
||||
sum += i;
|
||||
}
|
||||
|
||||
int max_x = 0;
|
||||
char max_c;
|
||||
for (int i = 0; i < 'z' - 'a'; i++) {
|
||||
if (counter[i] > max_x) {
|
||||
max_x = counter[i];
|
||||
max_c = 'a' + i;
|
||||
}
|
||||
}
|
||||
cout << sum << ' ' << max_c << '\n';
|
||||
}
|
||||
Reference in New Issue
Block a user