Practice
Resources
Contests
Online IDE
New
Free Mock
Events New Scaler
Practice
Improve your coding skills with our resources
Contests
Compete in popular contests with top coders
Events
Attend free live masterclass hosted by top tech professionals
New
Scaler
Explore Offerings by SCALER

# Introduction to Strings

Problem Description

"A string is traditionally a sequence of characters, either as a literal constant or as some kind of variable." — Wikipedia: String (computer science)

This exercise is to test your understanding of Java Strings. A sample String declaration:

String myString = "Hello World!"

The elements of a String are called characters. The number of characters in a string is called the length, and it can be retrieved with the String.length() method.

Some important methods for Strings in Java:

• stringName.charAt(index) : returns char value for the particular index
• stringName.isEmpty() : checks if string is empty.(Return type boolean).

Given two strings of lowercase English letters, A  and B, perform the following operations:

• Sum the lengths of and B.
• Determine if A is lexicographically larger than B (i.e.: does B come before A in the dictionary?).
• Capitalize the complete string and and print them on a single line, separated by a space.

Input Format

The first line contains string A. The second line contains another string B. The strings are comprised of only lowercase English letters.

Output Format

There are three lines of output:

For the first line, sum the lengths of A and B.

For the second line, write Yes if A is lexicographically greater than B otherwise print No instead.

For the third line, Capitalize the complete string and and print them on a single line, separated by a space.

Example Input

Input 1:

``` abc
def
```

Example Output

Output 1:

``` 6
No
ABC DEF
```

Example Explanation

Explanation 1:

``` Length of A = 3 and B = 3 so len(A) + len(B) = 6
String "abc" is lexicographically smaller than "def"```
Hints
• Complete Solution

## Discussion

Free Mock Assessment
Fill up the details for personalised experience.
Phone Number *
OTP will be sent to this number for verification
+1 *
+1
Change Number
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
*Enter the expected year of graduation if you're student
Current Employer
Company Name
College/University Name
Job Title
Job Title
Software Development Engineer (Backend)
Software Development Engineer (Frontend)
Software Development Engineer (Full Stack)
Data Scientist
Android Engineer
iOS Engineer
Devops Engineer
Support Engineer
Research Engineer
Engineering Intern
QA Engineer
Co-founder
SDET
Product Manager
Product Designer
Backend Architect
Program Manager
Release Engineer