Count characters at same position as in English alphabets - GeeksforGeeks
Given a string of lower and uppercase characters, the task is to find that how many characters are at same position as in English alphabets.
Read full article from Count characters at same position as in English alphabets - GeeksforGeeks
Given a string of lower and uppercase characters, the task is to find that how many characters are at same position as in English alphabets.
int findCount(string str){ int result = 0; // Travers input string for (int i = 0 ; i < str.size(); i++) // Check that index of characters of string is // same as of English alphabets by using ASCII // values and the fact that all lower case // alphabatic characters come together in same // order in ASCII table. And same is true for // upper case. if (i == (str[i] - 'a') || i == (str[i] - 'A')) result++; return result;}