Advertisement
yejolga

ol_4_15

Nov 3rd, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     ifstream cin("input.txt");
  10.  
  11.     short n;
  12.     cin>>n;
  13.  
  14.     bool no = true;
  15.     string pre = "", pre2 = "";
  16.     for(int i = 0; i < n; i++)
  17.     {
  18.         string cur;
  19.         cin>>cur;
  20.         if (pre2 == cur)
  21.         {
  22.             if (no)
  23.                 no = false;
  24.             cout<<i<<' ';
  25.         }
  26.         pre2 = pre;
  27.         pre = cur;
  28.     }
  29.     if (no)
  30.         cout<<-1;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement