@@ -86,21 +86,21 @@ class Solution {
86
86
}
87
87
88
88
Fraction result (stol (S.substr (0 , i)), 1 );
89
- const auto & non_repeat_part = S.substr (i + 1 );
90
- i = non_repeat_part .find (' (' );
89
+ const auto & non_int_part = S.substr (i + 1 );
90
+ i = non_int_part .find (' (' );
91
91
if (i == string::npos) {
92
- if (!non_repeat_part .empty ()) {
93
- result += Fraction (stol (non_repeat_part ),
94
- static_cast <int64_t >(pow (10 , non_repeat_part .length ())));
92
+ if (!non_int_part .empty ()) {
93
+ result += Fraction (stol (non_int_part ),
94
+ static_cast <int64_t >(pow (10 , non_int_part .length ())));
95
95
}
96
96
return result;
97
97
}
98
98
99
99
if (i > 0 ) {
100
- result += Fraction (stol (non_repeat_part .substr (0 , i)),
100
+ result += Fraction (stol (non_int_part .substr (0 , i)),
101
101
static_cast <int64_t >(pow (10 , i)));
102
102
}
103
- const auto & repeat_part = non_repeat_part .substr (i + 1 , non_repeat_part .length () - i - 2 );
103
+ const auto & repeat_part = non_int_part .substr (i + 1 , non_int_part .length () - i - 2 );
104
104
result += Fraction (stol (repeat_part),
105
105
static_cast <int64_t >(pow (10 , i)) *
106
106
(static_cast <int64_t >(pow (10 , repeat_part.length ())) - 1 ));
0 commit comments