Pagini recente » Cod sursa (job #1291927) | Cod sursa (job #450127) | Istoria paginii runda/gonathan | Cod sursa (job #2316580) | Cod sursa (job #832751)
Cod sursa(job #832751)
#include<fstream>
using namespace std;
char alfabet[60]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main()
{
ifstream cin("text.in");
ofstream cout("text.out");
char *text = new char[1050000];
char a;
int i=0;
//cin.get(text);
while (!cin.eof())
cin.get(text[i++]);
text[i-1]='\0';
cout<<text<<endl;
int l=0, cuv=0;
/*for (int j=0; j<i-1; j++)
{
if(('a'<=text[j] && text[j]<='z') || ('A'<=text[j] && text[j+1]<='Z'))
{
l++;
if( !('a'<=text[j+1] && text[j+1]<='z') || !('A'<=text[j+1] && text[j+1]<='Z'))
cuv++;
}
}*/
for(int start=0, stop=0; start<i-1 && stop<i-1;){
if(strchr(alfabet,text[stop])!=NULL)
{ cout<<text[stop];stop++; l++; }
else{
if(start!=stop)
cuv++;
start=stop+1;
stop=start;
}
}
int r = l/cuv;
cout<<endl<<l<<" "<<cuv<<" "<<r;
return 0;
}