#include <stdlib.h>
#include <vector>
#include <iostream>
void echo(std::string a);
std::string getBaseName(std::string s);
int main(int argc, char *argv[]){
    //  if user uses program incorrectly, print error message & exit.
    if(argc < 2) {
        printf("Usage: %s {filename.ext}\n", argv[0]);
        return 1;
    }
    std::string userinput = argv[1];
    echo(getBaseName(userinput));
}
void echo(std::string a){
    printf("%s\n",a.c_str());
}
std::string getBaseName(std::string s) {
    // getBaseName creates a substring up until the period character
    for(int j=s.size();j>0;j--){
        if(s[j]== '.'){
            return s.substr(0,j);
        }
    }
    return s.substr(0,0);
}