#include <iostream>
using namespace std;
int main() {
const int n = 5;
int arr[n]={0, 9, 0, 8, 1};
int j=0;
for (int i = 0; i < n; i++) {
if (arr[i] != 0) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
j++;
}
}
for (int i = 0; i < n; i++) {
printf("%d ", arr[i]);
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CiAgICBjb25zdCBpbnQgbiA9IDU7CiAgICBpbnQgYXJyW25dPXswLCA5LCAwLCA4LCAxfTsKICAgIGludCBqPTA7Cglmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgICAgIGlmIChhcnJbaV0gIT0gMCkgewogICAgICAgICAgICBpbnQgdGVtcCA9IGFycltpXTsgCiAgICAgICAgICAgIGFycltpXSA9IGFycltqXTsKICAgICAgICAgICAgYXJyW2pdID0gdGVtcDsKICAgICAgICAgICAgaisrOwogICAgICAgIH0KICAgIH0KICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CiAgICAgICAgcHJpbnRmKCIlZCAiLCBhcnJbaV0pOyAKICAgIH0KCXJldHVybiAwOwp9