You can do simply and use:: before the global variable or just remove the
long s; 
From main() because as you are declaring local variable s in the main() function. The Global s and local s are different despite having the same name. lets learn more by the following example by giving local and Global variable different name.
    #include <iostream>
long x;  // global value declaration
void output()  // don't want to pass argument
{
    std::cout << x;
}
int main()
{
    long s;
    std::cin >> s;  //here you are storing data on local variable s
    output() // But here you are calling global variable x. 
}
In main() function s is local and x is global variable and you are calling the global variable in output() function. you can use:: (scope resolution operator) for calling global x in main if u have the same naming or just call as it by variable name if they have a different name.
PS: If you have any question just do comment down hope this will help you and understand what's the mistake. Read more about the scope of the local and global variable here