RTE '16 J1 - Board Game

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

GoldenHippo is playing Scrabble. However, instead of playing normally, he is simply taking tiles out of a bag with practically unlimited tiles, and using them to make a sentence. However GoldenHippo is particularly concerned with the letter L.

Given the sentence that GoldenHippo made, he wants you to determine the number of Ls he took, as well as the maximum number of consecutive Ls taken, without taking another letter tile.

Input Specification

The input will consist of a single line, containing the sentence that was built. The sentence will only consist of uppercase letters and spaces and will be no longer than 1\,000 characters.

Output Specification

A single line, with two space separated integers. The first is the total number of L tiles that were used, and the second is the maximum number of consecutive L tiles.

Sample Input 1


Sample Output 1

3 2

Sample Input 2


Sample Output 2

2 2


  • 0
    Jack_Webster  commented on Jan. 27, 2020, 7:12 p.m.

    I can't get it to count consecutive letters.

    • 0
      Jan  commented on Jan. 28, 2020, 7:01 a.m.

      Your first step will be to get rid of the spaces. The following two lines of Python 3 code will do that for you:

      string = input()

      string_without_spaces = string.replace(" ", "")

  • 3
    franklai  commented on July 5, 2017, 5:07 p.m.

    Tip, if you are during it in Turing, of all forsaken languages, the max character limit per string is 256. You'll need to use some clever programming tricks to solve this.