Print Hello appended by input string
Following represents a mermaid diagram
graph LR
Question(Question) --> case[Test Case]
case --> input>Input]
case --> output>Output]
Question --> Solution
Solution --> Diagram
Solution --> Complexities
Complexities --> tc((Time))
Complexities --> sc((Space))
Solution --> Code
Test Cases
Input:
(string) s = "World"
Output:
(string) "Hello World"
Solution
#include <stdio.h>
void helloWorld(char* s) {
printf("Hello %s", s);
}
int main() {
helloWorld("C");
return 0;
}
#include <string>
#include <iostream>
using namespace std;
class Solution {
public:
void helloWorld(string s) {
cout<<"Hello "<<s;
}
};
int main() {
Solution solution;
solution.helloWorld("C++");
return 0;
}
using System;
class Solution {
public void helloWorld(string s) {
Console.WriteLine("Hello "+s);
}
}
package hello_world
import "fmt"
func helloWorld(s string) {
fmt.Printf("Hello %s", s)
}
func main() {
helloWorld("Golang")
}
import java.util.*;
class Solution {
public void helloWorld(String s) {
System.out.print("Hello "+s);
}
public static void main(String[] args) {
Solution solution = new Solution();
solution.helloWorld("Java");
}
}
const helloWorld = function (s) {
console.log("Hello "+s);
};
helloWorld("Javascript");
class Solution {
fun decodeString(s: String): void {
println("Hello"+s)
}
}
<?php
class Solution {
function helloWorld($s) {
echo "Hello ".$s;
}
}
$solution = new Solution();
$solution->helloWorld("PHP");
class Solution:
def helloWorld(self, s: str):
print("Hello", s)
if __name__ == "__main__":
solution = Solution()
solution.helloWorld("Python")
# @param {String} s
# @return {Void}
def decode_string(s)
printf "Hello %s", s
end
decode_string("Ruby")
impl Solution {
pub fn decode_string(s: String) -> void {
println("Hello {}", s);
}
}
object Solution {
def decodeString(s: String) = {
println("Hello "+s)
}
}
class Solution {
func reverseString(_ s: String) {
print("Hello "+s)
}
}
helloWorld(S) ->
io:format("hello ~p", [S]).
defmodule Hello do
def helloWorld(s) do
IO.puts "Hello ", s
end
end
(define/contract (hello-world s)
(-> string? void?)
(print "Hello ~v" s)
)