-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathSPOJ3638.cc
43 lines (38 loc) · 856 Bytes
/
SPOJ3638.cc
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
35
36
37
38
39
40
41
42
43
// SPOJ 3638: Word Counting
// http://www.spoj.com/problems/WORDCNT/
//
// Solution: ad-hoc
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cstring>
#include <functional>
#include <algorithm>
using namespace std;
#define ALL(c) c.begin(), c.end()
#define FOR(i,c) for(typeof(c.begin())i=c.begin();i!=c.end();++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define fst first
#define snd second
int main() {
string s;
getline(cin, s);
int T;
sscanf(s.c_str(), "%d", &T);
while (T--) {
getline(cin, s);
stringstream ss(s);
int len = -1;
int cnt, maxcnt = 0;
while (ss >> s) {
if (s.size() != len) {
len = s.size();
cnt = 0;
}
maxcnt = max(maxcnt, ++cnt);
}
printf("%d\n", maxcnt);
}
}