Advertisement
Infiniti_Inter

second way

Mar 13th, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. const int INF = 1e9 + 13;
  6.  
  7. int main(){
  8.     ifstream in("input.txt");
  9.     int Max_length = -INF;
  10.     int answer = -1;
  11.     int cur_index = 0;
  12.     string s;
  13.     while(getline(in, s))
  14.     {
  15.         cur_index++;
  16.         if (int(s.length()) > Max_length)
  17.         {
  18.             Max_length = s.length();
  19.             answer = cur_index;
  20.         }
  21.     }
  22.     cout << answer;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement