Convert Sentence to Pascal Case

Given a string STR, your task is to remove spaces from STR and convert it to Pascal case format. The function should return the modified STR.

In Pascal case, words are concatenated without spaces, and each word starts with an uppercase letter, including the first word.

Input:

The first line contains an integer T, the number of test cases. Each of the next T lines contains a separate test case string STR.

Output:

For each test case, return the string converted to Pascal case. Each output should be on a new line.

Example:

Input:
2
hello world
convert this string
Output:
HelloWorld
ConvertThisString

Constraints:

  • 1 ≤ T ≤ 5
  • 1 ≤ |STR| ≤ 10^5, where |STR| is the length of each input string.

Note:

The input string STR consists only of lowercase English letters without leading or trailing whitespace.

Implementation focuses solely on processing; output generation is managed externally.

AnswerBot
3d

Convert a given string to Pascal case format by removing spaces and capitalizing the first letter of each word.

  • Iterate through each character in the string

  • If the character is a space, skip it

  • If the ch...read more

Help your peers!
Add answer anonymously...
Oracle Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter