Valentine's Day '19 J3 - Love!

View as PDF

Submit solution

Points: 7 (partial)
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
Heart-pounding confession from Hinata to Yui.

If I can meet you again, against the 6 billion to 1 odds, even if you can't move, I'll marry you.

- Hideki Hinata, Angel Beats

Ah, how nice it is to be young and in love! Indeed, Jonathan truly appreciates the love that has been spread around the world. Notably, he admires the word love.

Now, Jonathan is provided with a string S from Evan. Jonathan wants to know how many subsequences of love are contained within the string that was provided. The letters of love must be in order, but do not necessarily have to be consecutive.


\left | S \right | \le 10^4, where \left | S \right | is the length of the string.

For 10% of the points, \left | S \right | \le 10.

For an additional 20% of the points, \left | S \right | \le 100.

Input Specification

The first line of input will contain a string S.

Output Specification

On a single line, output the number of subsequences love in S.

Sample Input 1


Sample Output 1


Sample Input 2


Sample Output 2



There are no comments at the moment.