<PREV Problem:
Solved by 210 users: ...


Time limit = 5 second(s)

Memory limit = 8 Mb

The language to write down fractions consists of one simple rule.
means a fraction, with numerator "a" and denominator "b". Spaces are not allowed in this language.
In order to represent this fraction in text mode with fixed character width, the fraction line is build up from "minus" characters and placed in such way, that numerator is completely above and denumerator — completely below the line. The numerator and denumerator should be placed according to this rule in such way, that the dimensions of the resulting fraction representation are minimal possible. Then two additional "minuses" are added to the fraction line — one on the left and one on the right.
For example, the fraction
Has the following representation
 2m     y
  n    z+1
The dimensions of fraction is this example are 11x7 characters.
Your task is to determine the horizontal and vertical size of the resulting fraction. You don't need to construct the fraction representation itself.

Input The first and only line contains the string with fraction specifiction. The length of te string does not exceed 50 characters.

Output Two numbers separated by one or more spaces — the width and height of the fraction in characters respectively.

1 1
11 7
10 3

Korolev Dmitry
2 april 2004

<PREV | Problem set | Search related messages | NEXT>

© acm.mipt DevGroup
The page was generated in 210ms

SW soft NIX
ID =