Pangrams

  • + 0 comments

    My solution in C++

    string pangrams(string s) {
        vector<bool> isTrue(26);
        
        for(char chr : s){
            chr = tolower(chr);
            if(static_cast<int>(chr)>=97 && static_cast<int>(chr)<=122 )
                isTrue[static_cast<int>(chr)-97]=true; 
         }
        bool allTrue = all_of(isTrue.begin(), isTrue.end(), [](bool n){return n;});
        if(allTrue)
            return "pangram";
        else
            return "not pangram";
    }