rt,求hack
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
main(){
string t;
cin>>t;
int l = t.size();
int maxlen_0 = -1,maxlen_wz = -1,wzt,mwzt;
int q = 0;
bool b = 0;
int cnt = 0;
for(int i=0;i<=l-4;i+=5){
string p = "";
p.pb(t[i]);
p.pb(t[i+1]);
p.pb(t[i+2]);
p.pb(t[i+3]);
if(p=="0000"){
q++;
cnt++;
if(q==1&&b!=1){
wzt = i;
}
b = 1;
}
else q = 0;
if(q>maxlen_0){
maxlen_0 = q;
maxlen_wz = i;
mwzt = wzt;
b = 0;
}
}
if(cnt>1){
for(int i=maxlen_wz+3;i>=mwzt;i--){
t.erase(i,1);
}
}
string ans = "";
if(t[t.size()-1]==':') t.pb(':');
for(int i=0;i<=t.size()-4;i++){
if(t.size()<4) break;
string p = t.substr(i,4);
if(p.find(':')!=p.npos){
continue;
}
else{
for(int j=0;j<=p.size()-1;j++){
if(p[j]!='0') break;
p.erase(j,1);
j--;
}
int y = p.size()-4;
ans = ans+p;
if(p.size()==0) ans.pb('0');
ans.pb(':');
if(t[i+5]==':') ans.pb(':');
i-=y;
}
}
if(ans[ans.size()-2]!=':'&&ans[ans.size()-1]==':') ans.erase(ans.size()-1,1);
if(mwzt==0) ans = "::"+ans;
cout<<ans;
}