include fstream using namespace std ifstream cin segredo in ofstream c

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <fstream>
using namespace std;
ifstream cin("segredo.in");
ofstream cout("segredo.out");
char c; //a=97 z=122
int a[125],minA,maxA=0;
int main(){
while(!cin.eof())
{
cin>>c;
a[(int)c]++;
}
a[(int)c]--;
minA=a[97];
for (int i=97;i<123;i++)
{
if((minA>a[i])&&(a[i]>0)) minA=a[i];
if(maxA<a[i]) maxA=a[i];
}
for (int i=97;i<123;i++)
{
if(a[i]==maxA) cout<<(char)i;
}
cout<<endl;
for (int i=97;i<123;i++)
{
if(a[i]==minA) cout<<(char)i;
}
cout<<endl;
for(int i=97;i<123;i++)
cout<<a[i]<<" ";
return 0;
}