File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -29,22 +29,23 @@ class TextEditor {
29
29
for (int _ = 0 ; _ < cnt; ++_) {
30
30
right_.push_back (left_.back ()); left_.pop_back ();
31
31
}
32
- return last_10 ();
32
+ return last_characters ();
33
33
}
34
34
35
35
string cursorRight (int k) {
36
36
const int cnt = min (k, static_cast <int >(size (right_)));
37
37
for (int _ = 0 ; _ < cnt; ++_) {
38
38
left_.push_back (right_.back ()); right_.pop_back ();
39
39
}
40
- return last_10 ();
40
+ return last_characters ();
41
41
}
42
42
43
43
private:
44
- string last_10 () {
45
- return left_.substr (max (static_cast <int >(size (left_)) - 10 , 0 ), 10 );
44
+ string last_characters () {
45
+ return left_.substr (max (static_cast <int >(size (left_)) - LAST_COUNT , 0 ), LAST_COUNT );
46
46
}
47
47
48
+ static const int LAST_COUNT = 10 ;
48
49
string left_;
49
50
string right_;
50
51
};
You can’t perform that action at this time.
0 commit comments