Read, Search and Substitute problem

Greetings to all,

I’m new in the comunity so pardon my lack of experience…I’ve stumbled upon the following problem in which I need from you guys some light on how to build the code:

The code must:

  • read a .txt file
  • track two differents combination of algarisms which follows a same number
  • leave the following number with only 4 numbers after the decimal separator point.

We search for the strings “VunTrib” and “VunCom”
The code reads the .txt file with the following content:


The output should be:


*Notice that the searched string may appear many times in the text with different numbers to be adjusted to only 4 decimal numbers.
*If the number has less than 4 decimal numbers, there’s no need to be adjusted.
*I accept suggestions of writing this code in other languages apart from C++

Thanks in advance for whoever is willing to help!