सीधे मुख्य सामग्री पर जाएं

संदेश

HackerRank DSA Problem Solution लेबल वाली पोस्ट दिखाई जा रही हैं

HackerRank Java Substring Problem Solution

  HackerRank Java Substring Problem Solution  Given a string,  , and two indices,   and  , print a  substring  consisting of all characters in the inclusive range from   to  . You'll find the  String  class' substring method  helpful in completing this challenge. Input Format The first line contains a single string denoting  . The second line contains two space-separated integers denoting the respective values of   and  . Constraints String   consists of English alphabetic letters (i.e.,  ) only. Output Format Print the substring in the inclusive range from   to  . Sample Input Helloworld 3 7 Sample Output lowo Explanation In the diagram below, the substring is highlighted in  green : Solution : import  java.io.*; import  java.util.*; import  java.text.*; import  java.math.*; import  java.util.regex.*; public   class  Solution {      public   static   void  main(String[] args) {                  Scanner scanner = new  Scanner(System.in);         String  s = scanner.next();   

HakcerRank Java Strings Introduction Solution

  HakcerRank   Java Strings Introduction Solution  Problem: 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. Given two strings of lowercase English letters,   and  , perform the following operations: Sum the lengths of   and  . Determine if   is lexicographically larger than   (i.e.: does   come before   in the dictionary?). Capitalize the first letter in   and   and print them on a single line, separated by a space. Input Format The first line contains a string  . The second line contains another string  . 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   and  . For the second line, write  Yes  if   is lexicographically greater t