Lab: Strings and RegExp

16. Match Multiplication това е задачата която ме мъчи ако някой може да ми обясни условието което е следното . 

1.*Match Multiplication

You are given a text with numbers in it. Your job is to extract each number from the original text, multiply it by its offset from the start of the string and replace it back in the string. The offset should be calculated based on the original string. Check the examples to get a better idea.

The input comes as an array of strings with one element - the text which contains the numbers.

The output should be printed on the console - consisting of the same text with the number being replaced by their new values (after being multiplied by the offset).

Examples

Input

['8Just text 14 with number5 in i7.']

Output

0Just text 154 with number125 in i217.

Input

['Moar t3xt w1th 99 numbers in 17. C00l numb3rs 411 4rr0und.']

Output

Moar t18xt w11th 1485 numbers in 493. C0l numb126rs 18906 200rr0und.

Comments

We extract the first number 3 counting the indexes from the start we can see that the number 3 begins 6 characters from the start, thus we multiply 3 * 6 and receive the new number 18. Even though 18 takes 2 indexes and reinserting it would shift the rest of the text to the right, the offset of the next number 1 is counted from the original string where 1 is 11 characters from the start, thus we multiply 1 * 11. Continuing we receive the new values for all numbers.

Hint

Check the overloads for the String.replace function, there may be an overload that can help you.

 

при този input My bill: 2*2.50 (beer); 2* 1.20 (kepab); -2  * 0.5 (deposit).

как се получава това My bill: 5 (beer); 2.4 (kepab); -1 (deposit). 

и двата примерни излизат точно.

Благодаря предварително