Back
Close

Find the character

Statement

 Goal

For a given text t replace all sequences of the given character n by the number of characters in that sequence.
The text can contain only ASCII characters.
Input
Line 1: The character n.
Line 2: The text t.
Output
Line 1: The text t with replacements of n.
Constraints
Length of n = 1
1 ≤ Length of t ≤ 150
Example
Input
l
Hello world.
Output
He2o wor1d.

Game modes
Fastest, Shortest, Reverse

Test cases
Hello world Test
Input
l Hello world.
Output
He2o wor1d.

Validator 1 Validator
Input
i This is the first validator.
Output
Th1s 1s the f1rst val1dator.

Upper Lower Test
Input
E DiD yOu pay atteNtion to the diffErEnCe bEtwEen upPer and loWer case lettErs?
Output
DiD yOu pay atteNtion to the diff1r1nCe b1tw1en upPer and loWer case lett1rs?

Validator 2 Validator
Input
a This is a vAlidAtor to check WHEther upper AND lower case letters have been observed. AaaaAAa
Output
This is 1 vAlidAtor to check WHEther upper AND lower c1se letters h1ve been observed. A3AA1

Long string Test
Input
b AcdefbbghijklMnbbbopqrstuvBBwxyzacdefghijklmbnopqrstuvwxyzacdbefghijklmnopqrstBuvwxyzacdefgbbbhijklmNopqrstuvwxyz
Output
Acdef2ghijklMn3opqrstuvBBwxyzacdefghijklm1nopqrstuvwxyzacd1efghijklmnopqrstBuvwxyzacdefg3hijklmNopqrstuvwxyz

Validator 3 Validator
Input
z AzbcDefGzHIjklmnZZOpqrstuvWzzzzxyaBcDefghijkLzzmnopqrstuvwzzxyabCdEFGHIJKLmnoPQRzzSTUVWxy
Output
A1bcDefG1HIjklmnZZOpqrstuvW4xyaBcDefghijkL2mnopqrstuvw2xyabCdEFGHIJKLmnoPQR2STUVWxy

Space Test
Input
_ Coding_on_Codingame_is__fun.
Output
Coding1on1Codingame1is2fun.

Validator 4 Validator
Input
_ I_like_it___very_much.
Output
I1like1it3very1much.

Beginning Test
Input
a aaabcdef
Output
3bcdef

Validator 5 Validator
Input
z zzzzzzyxwvu
Output
6yxwvu

One letter (the same) Test
Input
a a
Output
1

Validator 6 Validator
Input
z z
Output
1

One letter (not the same) Test
Input
b a
Output
a

Validator 7 Validator
Input
w z
Output
z

Numbers in t Test
Input
s 2 elephants stand with their 3 children on 1 meadow with 1285 blades of grass.
Output
2 elephant1 1tand with their 3 children on 1 meadow with 1285 blade1 of gra2.

Validator 8 Validator
Input
o With the 2 elephants, 7 giraffes (1 herd) move to a zoo in which 42 other animals live already.
Output
With the 2 elephants, 7 giraffes (1 herd) m1ve t1 a z2 in which 42 1ther animals live already.

Double digit repetitions Test
Input
a aaaaaaaaaaaa
Output
12

Validator 9 Validator
Input
v vvvvvvvvvvvvvvv
Output
15

n is a number Test
Input
5 55 % of the trains are too late, but 65 % are in time. I think there is a mistake.
Output
2 % of the trains are too late, but 61 % are in time. I think there is a mistake.

Validator 10 Validator
Input
9 1999 was 21 years ago. 2 years ago, it was 19 years.
Output
13 was 21 years ago. 2 years ago, it was 11 years.

End Test
Input
@ aaabcde@@@@
Output
aaabcde4

Validator End Validator
Input
f aaabcdeffff
Output
aaabcde4

Solution language

Solution

Stub generator input