Back to Cosmos

Problem Link

code/online_challenges/src/codechef/JAIN/README.md

latest661 B
Original Source

Problem Link

JAIN

Description

Chef has N dishes, numbered 1 through N. For each valid i, dish i is described by a string Di containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.

A meal consists of exactly two dishes. Preparing a meal from dishes i and j (i≠j) means concatenating the strings Di and Dj in an arbitrary order into a string M describing the meal. Chef likes this meal if the string M contains each lowercase vowel at least once.

Now, Chef is wondering - what is the total number of (unordered) pairs of dishes such that he likes the meal prepared from these dishes?