fork download
  1. #include<iostream>
  2. #include<algorithm>
  3. #include<stdlib.h>
  4. #include<string.h>
  5. #include<iomanip>
  6. #include<math.h>
  7. #include<bits/stdc++.h>
  8.  
  9. using namespace std;
  10. int main()
  11. {
  12. int n,cnt=0;
  13. cin>>n;
  14. string s;
  15. cin>>s;
  16. for(int i=0;i<n;i++)
  17. {
  18. if(s[i]=='1')
  19. {
  20. cnt++;
  21. }
  22. }
  23. if(cnt==0)
  24. {
  25. cout<<s<<endl;
  26. }
  27. else
  28. {
  29. char ar[10000000];
  30. ar[0]='1';
  31. for(int i=1;i<(n+1-cnt);i++)
  32. {
  33. ar[i]='0';
  34. }
  35. cout<<ar<<endl;
  36. }
  37. return 0;
  38. }
  39.  
Success #stdin #stdout 0s 24872KB
stdin
1
0
stdout
0