题目描述
Please create a function to extract the filename extension from the given path,return the extracted filename extension or null if none.
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
string s;
cin>>s;
int i;
for(i=0;i<s.length();++i)
{
if(s[i]=='.') break;
}
if(i==s.length())
{
cout<<"null"<<endl;
}else
{
for(i++;i<s.length();++i)
{
cout<<s[i];
}
cout<<endl;
}
return 0;
}