Question: Capgemini, Recent Online Assessment(OA) Questions | Dream String | Feb 2025
0
Entering edit mode

Problem Statement: Dream String

You are given a string S of length N. Your task is to determine and print the minimum number of operations required to convert S into a Dream string.

A Dream string consists only of vowels.

In an operation, you select an index i in S and increment S[i] to the next character cyclically. That is, 'a' becomes 'b', 'b' becomes 'c', and so on, and 'z' becomes 'a'.

Note:

  • If S is already a Dream string, print 0.
  • The vowels are 'a', 'e', 'i', 'o', and 'u'.
  • It is guaranteed that any string can be converted to a Dream string using a finite number of operations.

Input Format:

The input consists of two lines:

  • The first line contains a single integer N—the length of the string S.
  • The second line contains a single string S.

Output Format:

Print one number—the minimum number of operations required to convert string S into a Dream string.

ADD COMMENTlink 15 hours ago Rohit • 0

Login before adding your answer.

Similar Posts
Loading Similar Posts