#include <iostream>
using namespace std;
int main()
{
    string input; //User input
    char a; //Individual characters
    int score(0); //Final score
    int numa(0); //Number of a
    int numg(0); //Number of g
    int numm(0); //Number of m
    int numf(0); //Number of f
    int numk(0); //Number of k
    int numj(0); //Number of j
    cout << "Enter Text: "; //Requesting and storing user input
    cin >> input;
    cout << endl;
    a = input[0];
    cout << a;
    if(a != '!' || a != '.')
    {
        int num(0);
        while(num<=input.length())
        {
            a = input[num];
            switch(a)
            {
                case 'a':
                case 'A':
                    score += 1;
                    numa++;
                    break;
                case 'g':
                case 'G':
                    score += 2;
                    numg++;
                    break;
                case 'm':
                case 'M':
                    score += 3;
                    numm++;
                    break;
                case 'f':
                case 'F':
                    score += 4;
                    numf++;
                    break;
                case 'k':
                case 'K':
                    score += 5;
                    numk++;
                    break;
                case 'j':
                case 'J':
                    score += 8;
                    numj++;
                    break;
                default:
                    break;
            }
            num++;
        }
    }
    cout << "Number of a's (worth 1 point each): " << numa << endl;
    cout << "Number of g's (worth 2 point each): " << numg << endl;
    cout << "Number of m's (worth 3 point each): " << numm << endl;
    cout << "Number of f's (worth 4 point each): " << numf << endl;
    cout << "Number of k's (worth 5 point each): " << numk << endl;
    cout << "Number of j's (worth 8 point each): " << numj << endl;
    cout << endl;
    cout << "Total score: " << score;
}
This program takes a user input and gives it a score based on what is contained in it. The letter a gives 1 point, g gives 2, m gives 3, f gives 4, k gives 5, and j gives 8. However, it only goes until there is a "!" or ".". So, while aaa! and aaa. gives 3 points, aaa!aa and aaa.aa should also only give 3 points for both since everything after "!" and "." is disregarded. It also shouldn't run if the string doesn't end with "!" or ".", aaaa! and aaaa. returns 4 points for both while aaaa returns nothing. Trouble is, if there is a space or say letter t which isn't defined in the switch statements, the program just doesn't run. The end goal is for this statement, "she made a familiar attempt Just right." to return a score of 28.
 
    