Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'You are given a string s consisting of lowercase Latin letters. Let the length of s be |s| . You may perform several operations on this string. In one operation, you can choose some index i and remove the i -th character of s ( s_i ) if at least one of its adjacent characters is the previous letter in the Latin alphabet for s_i . For example, the previous letter for b is a, the previous letter for s is r, the letter a has no previous letters. Note that after each removal the length of the string decreases by one. So, the index i should satisfy the condition 1 <= i <= |s| during each operation. For the character s_i adjacent characters are s_{i-1} and s_{i+1} . The first and the last characters of s both have only one adjacent character (unless |s| = 1 ). Consider the following example. Let s= bacabcab. Your task is to find the maximum possible number of characters you can remove if you choose the sequence of operations optimally. The first line of the input contains one integer |s| ( 1 <= |s| <= 100 ) -- the length of s . The second line of the input contains one string s consisting of |s| lowercase Latin letters. Print one integer -- the maximum possible number of characters you can remove if you choose the sequence of moves optimally. The first example is described in the problem statement. Note that the sequence of moves provided in the statement is not the only, but it can be shown that the maximum possible answer to this test is 4 . In the second example, you can remove all but one character of s . The only possible answer follows. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
72186659 |
ruban |
C |
March 1, 2020, 2:11 p.m. |
OK |
Delphi |
TESTS |
47 |
31 |
0 |
|
|
72187002 |
zsz12251665 |
C |
March 1, 2020, 2:13 p.m. |
OK |
FPC |
TESTS |
47 |
31 |
102400 |
|
|
72193652 |
LaSWeeG |
C |
March 1, 2020, 2:38 p.m. |
OK |
FPC |
TESTS |
47 |
31 |
102400 |
|
|
72183770 |
Pocepko |
C |
March 1, 2020, 2:02 p.m. |
OK |
FPC |
TESTS |
47 |
31 |
102400 |
|
|
72186958 |
sagittarius_fjz |
C |
March 1, 2020, 2:12 p.m. |
OK |
FPC |
TESTS |
47 |
31 |
102400 |
|
|
72193575 |
Lycfucking. |
C |
March 1, 2020, 2:38 p.m. |
OK |
FPC |
TESTS |
47 |
31 |
204800 |
|
|
72199382 |
755352046 |
C |
March 1, 2020, 3:03 p.m. |
OK |
GNU C11 |
TESTS |
47 |
31 |
0 |
|
|
72197574 |
Ainfin |
C |
March 1, 2020, 2:55 p.m. |
OK |
GNU C11 |
TESTS |
47 |
46 |
0 |
|
|
72181953 |
SevenDawns |
C |
March 1, 2020, 1:56 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
30 |
0 |
|
|
72187696 |
wenzhuan |
C |
March 1, 2020, 2:15 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
30 |
0 |
|
|
72202390 |
jintiandun |
C |
March 1, 2020, 3:14 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
30 |
0 |
|
|
72192182 |
linyizhou |
C |
March 1, 2020, 2:32 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
30 |
204800 |
|
|
72216860 |
Moeyyy |
C |
March 1, 2020, 8:49 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
0 |
|
|
72214900 |
Towfiq379 |
C |
March 1, 2020, 7:50 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
0 |
|
|
72214510 |
MarioGS_ |
C |
March 1, 2020, 7:41 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
0 |
|
|
72214196 |
programmisstt |
C |
March 1, 2020, 7:33 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
0 |
|
|
72217007 |
Oliseus |
C |
March 1, 2020, 8:54 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
0 |
|
|
72217303 |
Iron_man_3000love |
C |
March 1, 2020, 9:04 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
0 |
|
|
72181233 |
sparsh_batra29 |
C |
March 1, 2020, 1:53 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
15 |
0 |
|
|
72200725 |
satyamgarg121 |
C |
March 1, 2020, 3:08 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
15 |
102400 |
|
|
72206198 |
spookywooky |
C |
March 1, 2020, 4:50 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
15 |
204800 |
|
|
72208317 |
cflaji |
C |
March 1, 2020, 5:27 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
30 |
0 |
|
|
72207231 |
NaimSS |
C |
March 1, 2020, 5:07 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
30 |
0 |
|
|
72205322 |
sovara |
C |
March 1, 2020, 4:38 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
30 |
0 |
|
|
72201367 |
lmarioza |
C |
March 1, 2020, 3:11 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
30 |
0 |
|
|
72200903 |
Is97 |
C |
March 1, 2020, 3:09 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
30 |
0 |
|
|
72211051 |
ilijaIR1331IR |
C |
March 1, 2020, 6:24 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
30 |
0 |
|
|
72217345 |
SilverFire |
C |
March 1, 2020, 9:05 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
30 |
0 |
|
|
72200191 |
KIko643 |
C |
March 1, 2020, 3:06 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
15 |
102400 |
|
|
72215537 |
mailo102 |
C |
March 1, 2020, 8:07 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
0 |
|
|
72215241 |
Azizul_cse27 |
C |
March 1, 2020, 7:59 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
0 |
|
|
72215124 |
TheNextJojo |
C |
March 1, 2020, 7:56 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
0 |
|
|
72213614 |
OnlyDeniko |
C |
March 1, 2020, 7:20 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
0 |
|
|
72212588 |
ChandVachhani_ |
C |
March 1, 2020, 6:56 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
0 |
|
|
72212432 |
kiamehr_khademi |
C |
March 1, 2020, 6:53 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
0 |
|
|
72211917 |
JustAndreyka |
C |
March 1, 2020, 6:42 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
0 |
|
|
72216540 |
WrongAnswerOnTest1 |
C |
March 1, 2020, 8:38 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
0 |
|
|
72217664 |
AN_FBS_IK |
C |
March 1, 2020, 9:19 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
0 |
|
|
72213298 |
ontake |
C |
March 1, 2020, 7:12 p.m. |
OK |
Go |
TESTS |
47 |
31 |
0 |
|
|
72188312 |
synapse |
C |
March 1, 2020, 2:17 p.m. |
OK |
Go |
TESTS |
47 |
31 |
0 |
|
|
72182860 |
Jughead |
C |
March 1, 2020, 1:59 p.m. |
OK |
Go |
TESTS |
47 |
46 |
0 |
|
|
72187217 |
j31d0 |
C |
March 1, 2020, 2:13 p.m. |
OK |
Haskell |
TESTS |
47 |
62 |
102400 |
|
|
72211206 |
jenish9599 |
C |
March 1, 2020, 6:28 p.m. |
OK |
Java 11 |
TESTS |
47 |
171 |
0 |
|
|
72206775 |
aswals8991 |
C |
March 1, 2020, 4:59 p.m. |
OK |
Java 11 |
TESTS |
47 |
186 |
0 |
|
|
72205938 |
hakr_2104 |
C |
March 1, 2020, 4:46 p.m. |
OK |
Java 11 |
TESTS |
47 |
187 |
0 |
|
|
72201614 |
aswals8991 |
C |
March 1, 2020, 3:12 p.m. |
OK |
Java 11 |
TESTS |
47 |
187 |
0 |
|
|
72197131 |
GiantTornado |
C |
March 1, 2020, 2:53 p.m. |
OK |
Java 11 |
TESTS |
47 |
187 |
0 |
|
|
72185358 |
myacdream |
C |
March 1, 2020, 2:07 p.m. |
OK |
Java 11 |
TESTS |
47 |
187 |
0 |
|
|
72184645 |
TheSawan |
C |
March 1, 2020, 2:04 p.m. |
OK |
Java 11 |
TESTS |
47 |
187 |
0 |
|
|
72214788 |
_lucho |
C |
March 1, 2020, 7:48 p.m. |
OK |
Java 11 |
TESTS |
47 |
202 |
0 |
|
|
72208035 |
Hexomiter |
C |
March 1, 2020, 5:22 p.m. |
OK |
Java 11 |
TESTS |
47 |
202 |
0 |
|
|
72204876 |
Younoknowme |
C |
March 1, 2020, 4:34 p.m. |
OK |
Java 11 |
TESTS |
47 |
202 |
0 |
|
|
72216321 |
zekigurbuz |
C |
March 1, 2020, 8:31 p.m. |
OK |
Java 8 |
TESTS |
47 |
109 |
0 |
|
|
72211341 |
adarsh000321 |
C |
March 1, 2020, 6:31 p.m. |
OK |
Java 8 |
TESTS |
47 |
124 |
0 |
|
|
72215755 |
YahiaSherif |
C |
March 1, 2020, 8:13 p.m. |
OK |
Java 8 |
TESTS |
47 |
124 |
0 |
|
|
72214168 |
Agnimandur |
C |
March 1, 2020, 7:33 p.m. |
OK |
Java 8 |
TESTS |
47 |
124 |
0 |
|
|
72210613 |
horseprabhat625 |
C |
March 1, 2020, 6:16 p.m. |
OK |
Java 8 |
TESTS |
47 |
124 |
0 |
|
|
72201928 |
mareshkau |
C |
March 1, 2020, 3:13 p.m. |
OK |
Java 8 |
TESTS |
47 |
124 |
0 |
|
|
72200346 |
ShesMyNerd |
C |
March 1, 2020, 3:07 p.m. |
OK |
Java 8 |
TESTS |
47 |
124 |
0 |
|
|
72200044 |
shashwat07 |
C |
March 1, 2020, 3:05 p.m. |
OK |
Java 8 |
TESTS |
47 |
124 |
0 |
|
|
72197329 |
an09mous |
C |
March 1, 2020, 2:54 p.m. |
OK |
Java 8 |
TESTS |
47 |
124 |
0 |
|
|
72197036 |
Ajudiya_13 |
C |
March 1, 2020, 2:52 p.m. |
OK |
Java 8 |
TESTS |
47 |
124 |
0 |
|
|
72184815 |
jonas.havelka.42 |
C |
March 1, 2020, 2:05 p.m. |
OK |
Kotlin |
TESTS |
47 |
139 |
0 |
|
|
72181384 |
HeartPattern |
C |
March 1, 2020, 1:54 p.m. |
OK |
Kotlin |
TESTS |
47 |
155 |
0 |
|
|
72190861 |
prpht |
C |
March 1, 2020, 2:27 p.m. |
OK |
Kotlin |
TESTS |
47 |
155 |
0 |
|
|
72185343 |
Schacher97 |
C |
March 1, 2020, 2:07 p.m. |
OK |
Kotlin |
TESTS |
47 |
155 |
0 |
|
|
72216932 |
Tlatoani |
C |
March 1, 2020, 8:52 p.m. |
OK |
Kotlin |
TESTS |
47 |
155 |
102400 |
|
|
72193600 |
frankhannes |
C |
March 1, 2020, 2:38 p.m. |
OK |
Kotlin |
TESTS |
47 |
155 |
102400 |
|
|
72189026 |
koboshi |
C |
March 1, 2020, 2:20 p.m. |
OK |
Kotlin |
TESTS |
47 |
156 |
0 |
|
|
72198694 |
Anastasiya_Andreevna |
C |
March 1, 2020, 3 p.m. |
OK |
Mono C# |
TESTS |
47 |
77 |
3584000 |
|
|
72187516 |
sergmel |
C |
March 1, 2020, 2:15 p.m. |
OK |
Mono C# |
TESTS |
47 |
93 |
4300800 |
|
|
72186921 |
songhaoran |
C |
March 1, 2020, 2:12 p.m. |
OK |
MS C++ |
TESTS |
47 |
31 |
0 |
|
|
72202088 |
wawahaha |
C |
March 1, 2020, 3:13 p.m. |
OK |
MS C++ |
TESTS |
47 |
31 |
102400 |
|
|
72191515 |
frank1586 |
C |
March 1, 2020, 2:29 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
0 |
|
|
72202487 |
elarek123 |
C |
March 1, 2020, 3:14 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
0 |
|
|
72195472 |
qwe123rt45 |
C |
March 1, 2020, 2:46 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
0 |
|
|
72191830 |
Gravekper |
C |
March 1, 2020, 2:31 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
0 |
|
|
72185426 |
Miris |
C |
March 1, 2020, 2:07 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
0 |
|
|
72197151 |
Najmus_Sakib_Rashid |
C |
March 1, 2020, 2:53 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
307200 |
|
|
72194089 |
529886336 |
C |
March 1, 2020, 2:40 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
307200 |
|
|
72191581 |
TsatskiPetski |
C |
March 1, 2020, 2:30 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
307200 |
|
|
72197479 |
Bullbas |
C |
March 1, 2020, 2:54 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
307200 |
|
|
72217463 |
Quantum_Evolution |
C |
March 1, 2020, 9:10 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
307200 |
|
|
72208403 |
klond90 |
C |
March 1, 2020, 5:29 p.m. |
OK |
Node.js |
TESTS |
47 |
218 |
512000 |
|
|
72197015 |
denchik007orel57 |
C |
March 1, 2020, 2:52 p.m. |
OK |
PascalABC.NET |
TESTS |
47 |
358 |
102400 |
|
|
72183066 |
rsFalse |
C |
March 1, 2020, 1:59 p.m. |
OK |
Perl |
TESTS |
47 |
46 |
0 |
|
|
72189731 |
rkstalker |
C |
March 1, 2020, 2:22 p.m. |
OK |
PyPy 2 |
TESTS |
47 |
140 |
409600 |
|
|
72188359 |
Gaurav1 |
C |
March 1, 2020, 2:17 p.m. |
OK |
PyPy 2 |
TESTS |
47 |
155 |
921600 |
|
|
72179570 |
c1729 |
C |
March 1, 2020, 1:48 p.m. |
OK |
PyPy 2 |
TESTS |
47 |
171 |
204800 |
|
|
72214520 |
codershuvo |
C |
March 1, 2020, 7:41 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
140 |
1433600 |
|
|
72205995 |
faking_legend |
C |
March 1, 2020, 4:46 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
140 |
1433600 |
|
|
72200533 |
mfeds |
C |
March 1, 2020, 3:07 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
155 |
1228800 |
|
|
72193620 |
Tejkiran |
C |
March 1, 2020, 2:38 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
155 |
1228800 |
|
|
72212138 |
thekushalghosh |
C |
March 1, 2020, 6:47 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
155 |
1331200 |
|
|
72191982 |
throwawayatcoder |
C |
March 1, 2020, 2:31 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
155 |
1331200 |
|
|
72182003 |
aberent |
C |
March 1, 2020, 1:56 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
155 |
1331200 |
|
|
72195410 |
_hejun_ |
C |
March 1, 2020, 2:45 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
155 |
1433600 |
|
|
72194535 |
wider93 |
C |
March 1, 2020, 2:42 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
155 |
1433600 |
|
|
72191821 |
Algohol |
C |
March 1, 2020, 2:30 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
155 |
1433600 |
|
|
72206319 |
SinKing |
C |
March 1, 2020, 4:51 p.m. |
OK |
Python 3 |
TESTS |
47 |
109 |
307200 |
|
|
72209853 |
_siddarthjain |
C |
March 1, 2020, 6:02 p.m. |
OK |
Python 3 |
TESTS |
47 |
109 |
512000 |
|
|
72206264 |
raghavparsai |
C |
March 1, 2020, 4:51 p.m. |
OK |
Python 3 |
TESTS |
47 |
109 |
512000 |
|
|
72206597 |
SinKing |
C |
March 1, 2020, 4:56 p.m. |
OK |
Python 3 |
TESTS |
47 |
124 |
307200 |
|
|
72199512 |
dino8egg |
C |
March 1, 2020, 3:03 p.m. |
OK |
Python 3 |
TESTS |
47 |
124 |
307200 |
|
|
72185787 |
plusplus6408 |
C |
March 1, 2020, 2:08 p.m. |
OK |
Python 3 |
TESTS |
47 |
124 |
307200 |
|
|
72184658 |
gjctxdy |
C |
March 1, 2020, 2:04 p.m. |
OK |
Python 3 |
TESTS |
47 |
124 |
307200 |
|
|
72183358 |
shade1010 |
C |
March 1, 2020, 2 p.m. |
OK |
Python 3 |
TESTS |
47 |
124 |
307200 |
|
|
72209728 |
dimitry.ageev |
C |
March 1, 2020, 5:58 p.m. |
OK |
Python 3 |
TESTS |
47 |
124 |
512000 |
|
|
72201964 |
Blue_Gene |
C |
March 1, 2020, 3:13 p.m. |
OK |
Python 3 |
TESTS |
47 |
124 |
512000 |
|
|
72202211 |
rustafarian |
C |
March 1, 2020, 3:13 p.m. |
OK |
Rust |
TESTS |
47 |
31 |
0 |
|
|
72196416 |
Nogard_ |
C |
March 1, 2020, 2:50 p.m. |
OK |
Rust |
TESTS |
47 |
31 |
0 |
|
|
remove filters
Back to search problems