#include <stdio.h>
#include <string.h>

struct stringStats
{
    int stringLength; //number of total characters in the string
    int upperCaseCount; //number of upper case characters
    int lowerCaseCount; //number of lower case characters
    int numDigits; //number of digits
    int numBlankSpaces; //number of blank spaces
    int nonAlphaChars; //number of non-alphanumeric characters
    int numVowels; //number of vowels (the letters a, e, i, o, u)   ... accept upper and lower case
    int numNonVowels; //number of non-vowels ... accept upper and lower case
    int numSpecChars; //number of special characters
    int numPrintableChars; //all printable characters that are neither alphanumeric nor a space. For example ‘@’, ‘$’, etc.
    int numHexaDecDigits; //number of hexadecimal "digits" -  0 through 9 ... and the letters A - F  ... accept upper and lower case
    int numOctalDigits; //number of octal "digits" - 0 to 7
    int numBinaryDigits; //number of binary "digits" - 0 or 1
    int numPunctChars; //number of punctuator characters
    int numControlChars; //number of control characters
};

//**************************************************************
// Function: stringStats
// 
// Purpose: Determine string stats
// 
// Parameters:
// 
//     theString - string/word that getting stats on 
//
// Returns: structure wth string stats
//  
//**************************************************************

// function prototype to get started, or better, use pointers */
struct stringStats getStringStats (char theString[]){

    //Declare a variable of type stringStats
    struct stringStats stringStats1;

    int numChars = strlen(theString); //calculate the number of characters
    stringStats1.stringLength=numChars;

    int numUpperCase=0; //initialize to 0 the number of upper case characters
    int numLowerCase=0; //initialize to 0 the number of lower case characters

    for (int i = 0; i < numChars; i++){ //looping through the number of characters in the string
        if (theString[i] >= 'A' && theString[i] <= 'Z'){
            /*numUpperCase++;*/ //looking for upper case characters and if found, increment the variable that stored the number of uppercase characters by 1 
        }
        else if (theString[i] >= 'a' && theString[i] <= 'z'){
            numLowerCase++; //looking for lower case characters and if found, increment the variable that stored the number of uppercase characters by 1
        }
    };

    stringStats1.upperCaseCount=numUpperCase;
    stringStats1.upperCaseCount=numLowerCase;

    return stringStats1;

};
int main() {

    // set up structure to store totals and initialize all to zero
    struct stringStats retStringStats  = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

	retStringStats = getStringStats("by");
    printf("Number of characters: %i\n", retStringStats.stringLength); 
    printf("Number of upper case letters: %i\n", retStringStats.upperCaseCount);
    printf("Number of lower case letters: %i\n", retStringStats.lowerCaseCount);  
	return 0;
};