/***************************************************
Process Directory File information to find largest
file.
Write a program that reads the output of my
directry listing, which looks like this:
-rwxr-xr-- 1 wcbrown faculty 7084 Aug 9 17:00 a.out*
-rw-r--r-- 1 wcbrown faculty 14016 Aug 10 08:03 Class.html
.
.
.
-rw-r--r-- 1 wcbrown faculty 620 Aug 9 17:00 test.cpp
valiant>
... and prints out the size of the largest file
in the directory. [File size (in bytes) is listed
after the word "faculty".]
***************************************************/
#include <iostream>
#include <string>
using namespace std;
int main()
{
// INITIALIZATION
string firstword;
cin >> firstword;
int max = -1;
// LOOP
while(firstword != "valiant>")
{
string s;
// Read line up to file size
cin >> s >> s >> s;
// Read file size & updata max if needed
int k;
cin >> k;
if (k > max)
max = k;
// Read rest of line
cin >> s >> s >> s >> s;
// Read first "word" of next line
cin >> firstword;
}
// WRITE RESULT
cout << "Largest file is " << max << " bytes" << endl;
return 0;
}