#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
int n;
string input;
while(cin >> n){
if(n == 0)break;
int cnt[n], mn = 25;
memset(cnt, 0, sizeof(cnt));
getchar();
for(int i = 0; i < n; i++){
getline(cin, input);
for(int j = 0; j < 25; j++)if(input[j] == 32)cnt[i]++;
mn = min(mn, cnt[i]);
}
int sum = 0, temp;
for(int i = 0; i < n; i++)temp = (cnt[i]-mn), sum += temp;
cout << sum << endl;
}
return 0;
}
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
int n;
string input;
while(cin >> n){
if(n == 0)break;
int cnt[n], mn = 25;
memset(cnt, 0, sizeof(cnt));
getchar();
for(int i = 0; i < n; i++){
getline(cin, input);
for(int j = 0; j < 25; j++)if(input[j] == 32)cnt[i]++;
mn = min(mn, cnt[i]);
}
int sum = 0, temp;
for(int i = 0; i < n; i++)temp = (cnt[i]-mn), sum += temp;
cout << sum << endl;
}
return 0;
}
No comments:
Post a Comment