HackerRank Pangrams problem solution YASH PAL, 31 July 2024 In this HackerRank Pangrams, problem Given a sentence determines whether it is a pangram in the English alphabet. Ignore case. Return either pangram or not pangram as appropriate. Topics we are covering Toggle Problem solution in Python programming.Problem solution in Java Programming.Problem solution in C++ programming.Problem solution in C programming.Problem solution in JavaScript programming. Problem solution in Python programming. s = set(list(input().lower())) letters = [] for i in range(97, 122): letters.append(i) for i, element in enumerate(s): if ord(element) in letters: letters.remove(ord(element)) if len(letters) > 0: print("not", end=" ") print("pangram") Problem solution in Java Programming. import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ try (Scanner sc = new Scanner(System.in)) { String line = sc.nextLine(); String lower = line.toLowerCase(); lower = lower.replace(" ", ""); Set<Character> chars = new HashSet<Character>(); for (int i = 0; i < lower.length(); ++i) { chars.add(lower.charAt(i)); } if (chars.size() != 26) { System.out.print("not "); } System.out.println("pangram"); } } } Problem solution in C++ programming. #include <iostream> #include <iomanip> #include <cstdio> #include <math.h> #include <algorithm> #include <queue> #include <string> #include <fstream> #include <vector> #include <stack> #include <map> #include <set> #include <ctime> #define all(x) (x).begin(), (x).end() #define pb push_back #define float long double #define LL long long #define itn int #define mp make_pair #define x first #define y second using namespace std; int main(){ string s; vector<int> a(256, 0); getline(cin, s); for (int i = 0; i < s.length(); i++){ a[s[i]]++; } for (char c = 'a'; c <= 'z'; c++){ if (a[c] + a[c - 'a' + 'A'] == 0){ cout << "not pangramn"; return 0; } } cout << "pangramn"; return 0; } Problem solution in C programming. #include <stdio.h> #include <string.h> #include <stdlib.h> char ss[1001]; int mark[26] = {0}; int main(){ int l, i; gets(ss); l = strlen(ss); for(i=0; i<l; i++){ if(ss[i]>='a' && ss[i]<='z')mark[ss[i]-'a'] = 1; else if(ss[i]>='A' && ss[i]<='Z')mark[tolower(ss[i])-'a'] = 1; } for(i=0; i<26; i++){ // printf("%d ", i); if(!mark[i])break; } // printf("n"); if(i==26)printf("pangramn"); else printf("not pangramn"); return 0; } Problem solution in JavaScript programming. function processData(input) { //Enter your code here var lowerInput = input.toLowerCase(); var letterArray = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']; for(var i = 0, l = letterArray.length; i < l; i++) { if(lowerInput.toLowerCase().indexOf(letterArray[i]) == -1) { console.log('not pangram'); return false; } } console.log('pangram'); } process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; }); process.stdin.on("end", function () { processData(_input); }); Algorithms coding problems solutions