Loading...
MarinesBG avatar MarinesBG 1 Точки

[Exercises] Programming Fundamentals -More Exercises: Strings And Text Processing - Problem {3} - Karate Strings

 

1.   Karate Strings

 

The most notorious person in SoftUni – Pesho is trying to become a karate master. Being a programmer, Pesho has no idea how to train, so he decided to train on strings.

 

His punches are marked with ‘>’. Immediately after the mark, there will be an integer, which signifies the strength of the punch.

 

You should remove x characters (where x is the strength of the punch), starting after the punch character (‘>’).

 

If you find another punch mark (‘>’) while you’re deleting characters, you should add the strength to your previous punch.

 

When all characters are processed, print the string without the deleted characters.

 

You should not delete the punch character – ‘>’, but you should delete the integers, which represent the strength.

 

Input

 

You will receive single line with the string, which is used by Pesho for training.

 

Output

 

Print what is left from the string after Pesho’s punches.

 

Constraints

 

·       You will always receive a strength for the punches

 

·       The path will consist only of letters from the Latin alphabet, integers and the char ‘>

 

·       The strength of the punches will be in the interval [0…9]

 

Examples

 

Input

Output

Comments

 

 

 abv>1>1>2>2asdasd 

 

 

 abv>>>>dasd 

  1st punch is at index 3 and it is with strength of 1. We delete only the digit after the punch character. The string will look like this: abv>>1>2>2asdasd

2nd punch is with strength one and the string transforms to this: abv>>>2>2asdasd

3rd punch is now with strength of 2. We delete the digit and we find another punch. At this point the string looks like this: abv>>>>2asdasd.

4th punch is with strength 2. We have 1 strength left from the previous punch, we add the strength of the current punch to what is left and that adds up to a total strength of 3. We delete the next three characters and we receive the string abv>>>>dasd

We do not have any more punches and we print the result: abv>>>>dasd

 

 

 

Input

Output

 pesho>2sis>1a>2akarate>4hexmaster 

 pesho>is>a>karate>master 

 

 

 

Не мога да си намеря грешката 

Judge  ми дава 66 точки ( 2-ра и 6-та проверка ми гърми ) 
 

Ето го и кода ми : 

https://pastebin.com/ziRcp2eG

Тагове:
0
Fundamentals Module 30/10/2017 13:23:34
MarinesBG avatar MarinesBG 1 Точки

Благодаря !

0
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.