-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1165 C.cpp
More file actions
41 lines (33 loc) · 734 Bytes
/
1165 C.cpp
File metadata and controls
41 lines (33 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
#define mx 1000
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n;
cin>>n;
//vector<char> str1;
//vector<char> str2;
string str1,str2;
cin>>str1;
for(int i=0; i<n ;i++)
{
int k = str2.size();
if(str1[i] != str2[k-1] || k%2 == 0)
{
str2.push_back(str1[i]);
//cout<<i<<" ";
//cout<<k<<" ";
}
}
//cout<<endl;
int temp = str2.size();
if(temp%2 != 0)
str2.erase(str2.end()-1);
cout<<str1.length()-str2.length()<<endl<<str2;
return (0);
}