Pagini recente » Rating Andrei Karina (KarinA) | Cod sursa (job #2285089) | Cod sursa (job #1858640) | Cod sursa (job #1860180) | Cod sursa (job #2155299)
#include <fstream>
using namespace std ;
bool isInString(string str) {
char c ;
for(int i = 0 ; i < str.size() ; i++) {
c = str[i] ;
if((c >= 'A' and c <= 'Z') or (c >= 'a' and c <= 'z')) {
return 1 ;
}
}
return 0 ;
}
int main() {
ifstream f("text.in") ;
string txt ;
getline(f, txt) ;
f.close() ;
int k = 0 ;
int cuv = 0 ;
char c ;
string aux ;
for(int i = 0 ; i < txt.size() ; i++) {
c = txt[i] ;
if((c >= 'A' and c <= 'Z') or (c >= 'a' and c <= 'z')) {
k++ ;
aux += c ;
}
else {
if(aux.size() and isInString(aux)) {
cuv++ ;
}
aux = "" ;
}
}
ofstream g("text.out") ;
g << k / cuv ;
g.close() ;
return 0 ;
}