Skip to content

Commit

Permalink
12416 solved
Browse files Browse the repository at this point in the history
  • Loading branch information
ksaveljev committed Mar 25, 2012
1 parent 75dd76b commit 22c0bf2
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions 12416.cpp
@@ -0,0 +1,34 @@
#include <iostream>
#include <cmath>
using namespace std;

#define REP(i, b, n) for (int i = b; i < n; i++)
#define rep(i, n) REP(i, 0, n)

int longest_spaces(string &input) {
int result = 0;
int tmp = 0;

rep (i, input.size()) {
if (input[i] == ' ') {
tmp++;
} else {
if (tmp > result)
result = tmp;

tmp = 0;
}
}

return result;
}

int main(void) {
string input;

while (getline (cin, input)) {
cout << ceil(log2(longest_spaces(input))) << endl;
}

return 0;
}

0 comments on commit 22c0bf2

Please sign in to comment.