| C++ code |
| 1 | #include <iostream> #include<fstream> #include<vector> #include <string> #include<algorithm> using namespace std; typedef unsigned long long ull; typedef unsigned uint; typedef unsigned long ulong; ifstream in("input.txt"); ofstream out("output.txt"); int main() { string s,sl; int n, count=1; in>>n; getline(in,sl); getline(in,sl); for(unsigned i =1 ;i<n; i++) { getline(in,s); if(s!=sl) count++; sl=s; } out<<count; return 0; } |
Комментарии