In this article, we will be solving HackerRank Day 0: Hello, World problem, part of 30 Days of Code. Majorly, we will use Python3 and Java15 to solve the problem.
Objective
In this challenge, we review some basic concepts that will get you started with this series. You will need to use the same (or similar) syntax to read input and write output in challenges throughout HackerRank. Check out the Tutorial tab for learning materials and an instructional video!
Task
Print Hello, World.
on the first line, and on the second line, we print the content of the input_string variable.
Input Format
A single line of text denoting input_string (the variable whose contents must be printed).
Output Format
Print Hello, World.
on the first line, and the contents of input_string on the second line.
Sample Input
Welcome to EGrasps
Sample Output
Hello, World.
Welcome to EGrasps.
You can find all the source code on my GitHub profile: https://github.com/uttammanani/HackerRank-30-Days-of-Code
Solution Day 0: Hello, World in Python3
# Read a full line of input from stdin and save it to our dynamically typed variable, input_string.
input_string = input()
# Print a string literal saying "Hello, World." to stdout.
print('Hello, World.')
print(input_string)
# TODO: Write a line of code here that prints the contents of input_string to stdout.
Solution Day 0: Hello, World in Java15
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
System.out.println("Hello, World.");
Scanner s1 = new Scanner(System.in);
String s = s1.nextLine();
System.out.println(s);
}
}
We hope that we bring some value to your life through posting our content, might content meet your expectations. You can always comment on the post to give feedback or reach out to us through email for sharing what you like to read on our blog.
Reach out to us using email: [email protected]
Find More Articles on Our Website: EGrasps
Check out our other posts on Medium.
You can reach out to us on WhatsApp.