Posts

Showing posts from July, 2020

Mars Exploration (Hackerrank)

Image
Sami's spaceship crashed on Mars! She sends a series of  SOS  messages to Earth for help. Letters in some of the  SOS  messages are altered by cosmic radiation during transmission. Given the signal received by Earth as a string,  , determine how many letters of Sami's  SOS  have been changed by radiation. For example, Earth receives  SOSTOT . Sami's original message was  SOSSOS . Two of the message characters were changed in transit. Function Description Complete the  marsExploration  function in the editor below. It should return an integer representing the number of letters changed during transmission. marsExploration has the following parameter(s): s : the string as received on Earth Input Format There is one line of input: a single string,  . Note:  As the original message is just  SOS  repeated   times,  's length will be a multiple of  . Constraints  will contain only uppercase English letters, ascii[A-Z]. Output Format Print the number of letters in Sami's me

Pangrams (Hackerrank)

Roy wanted to increase his typing speed for programming contests. His friend suggested that he type the sentence "The quick brown fox jumps over the lazy dog" repeatedly. This sentence is known as a  pangram  because it contains every letter of the alphabet. After typing the sentence several times, Roy became bored with it so he started to look for other pangrams. Given a sentence, determine whether it is a pangram. Ignore case. Function Description Complete the function  pangrams  in the editor below. It should return the string  pangram  if the input string is a pangram. Otherwise, it should return  not pangram . pangrams has the following parameter(s): s : a string to test Input Format Input consists of a string  . Constraints Each character of  ,  Output Format Output a line containing  pangram  if   is a pangram, otherwise output  not pangram . Sample Input 0 We promptly judged antique ivory buckles for the next prize Sample Output 0 pangram Sample Explanation 0 All of t