RoAlgo Contest #7 | cuvinte

This was the problem page during the contest. Access the current page here.
Time limit: 0.05s Memory limit: 64MB Input: Output:

The following functions are defined:

  • reverse(s)reverse(s): reverses the string ss;
  • order(s)order(s): rearranges the letters of the string ss in alphabetical order;
  • concat(s1,s2)concat(s_1,s_2): concatenates all the vowels in the word s2s_2 to the vowels in the word s1s_1, in order;
  • substr(s,x,y,p)substr(s,x,y,p): extracts the substring located between positions xx and yy in the word ss by stepping pp positions at a time starting from position xx, 1xystrlen(s)1 \leq x \leq y \leq strlen(s).

Examples:

  • reverse("hello")reverse("hello"): "olleh";
  • order("hello")order("hello"): "ehllo";
  • concat("hello","world")concat("hello", "world"): "eoo";
  • substr("helloworld",2,9,3)substr("helloworld", 2, 9, 3): "eor";

Task

Evaluate an expression composed of calls to these functions.

Input data

The first line of the input contains the expression to be evaluated.

Output data

The first line contains the result of the evaluation, enclosed in double quotes """ ".

Constraints and clarifications

  • 1strlen(expression)30 0001 \leq strlen(expression) \leq 30\ 000;
  • 1strlen(s)1001 \leq strlen(s) \leq 100, for any word ss;
  • In the tests, all words ss are enclosed in double quotes """ ".

Example 1

stdin

"helloworld"

stdout

"helloworld"

Explanation

There are no operations to perform.

Example 2

stdin

reverse(order(concat("hello",substr("world",1,5,1))))

stdout

"ooe"

Explanation

substr("world",1,5,1)substr("world",1,5,1): "world"
concat("hello",substr("world",1,5,1))concat("hello",substr("world",1,5,1)): "eoo"
order(concat("hello",substr("world",1,5,1)))order(concat("hello",substr("world",1,5,1))): "eoo"
reverse(order(concat("hello",substr("world",1,5,1))))reverse(order(concat("hello",substr("world",1,5,1)))): "ooe"

Log in or sign up to be able to send submissions!