First Program

#include<bits/stdc++.h> using namespace std; int main() { string str; int len,cnt=0,coun=0,temp; cin>>len; cin>>str; for(int i=0;i<str.size();i++) { if(str[i]=='0') cnt++; else coun++; } temp=min(cnt,coun); cout<<len-(temp*2)<<endl; return 0; }
556A Case of the Zeros and Ones.txt

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.