LCC/Moose '19 Contest 1 J5 - Om and uwu

View as PDF

Submit solution


Points: 7 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Om frequently uses "uwuwu" in his messages. Inspired to find the perfect message, he needs a way to quantify how good a message is. He defines the quality of a message as the number of substrings of the message that contain the subsequence "uwuwu". Given a string S consisting of lowercase English letters, determine the quality of the string.

We define a subsequence of a string S to be any string that can be obtained from S by deleting some (possibly no) characters from S.

Input Specification

The only line will contain a string S (1 \leq |S| \leq 10^6)

Output Specification

On the first line, output a single integer, the number of substrings.

Sample Input 1

uwowuwuowowuuow

Sample Output 1

25

Comments

There are no comments at the moment.