Add string based on character length

Good day, I am a newbie here and thanks for accepting me

I have a task to modify input data where my input data looks like

123|34567|CHINE
1|23|INDIA
34512|21|USA
104|901|INDIA

See that my input has two columns with different character length but max length is 5 and minimum length is 0 which is column 1 & column 2, for example first row is 123|34567 with character length is 3|5

I need to produce an output that all character must be in 5|5 character length, so when its only 3 character then put 00 in front, when character length is 1 then put 0000 in front

based on my file input, desired output should be like

00123|34567|CHINE
00001|00023|INDIA
34512|00021|USA
00104|00901|INDIA

please help

Welcome fastlearner,
You can do it with awk :

awk -F\| '{$1=sprintf("%05d",$1);$2=sprintf("%05d",$2)}OFS=FS' file

Regards.