//第一题
#include <stdio.h>
#include<iostream>
#include<ctime>
#include<cstdlib>
#include<cmath>
using namespace std;
int main()
{
string s;
int ans(0),x;
cin>>s;
for(int i=0;i<s.length();i++)
{
if(isalpha(s[i])==0)
{
x=s[i]-'0';
while(isalpha(s[++i])==0 && i<s.length())
x=x*10+s[i]-'0';
if(x>ans)ans=x;
}
}
cout<<ans;
return 0;
}
//第二题
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int z[10];
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>z[i];
}
for(int i=0;i<n;){
if(z[i+1]-1==z[i]){
int cc=i;
int num=0;
while(z[i+1]-1==z[i]){
num++;
i++;
}
if(num>=2){
if(cc!=0){
cout<<',';
}
cout<<z[cc]<<'-'<<z[i];
i++;
}
else {
i=cc;
if(cc!=0){
cout<<',';
}
cout<<z[i];
i++;
}
}
else {
if(i!=0){
cout<<',';
}
cout<<z[i];
i++;
}
}
return 0;
}
//第三题
#include <stdio.h>
#include<iostream>
#include<ctime>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
int n;
int a[110];
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<n;i++)
cout<<a[i];
cout<<endl;
while(next_permutation(a,a+n))
{
for(int i=0;i<n;i++)
cout<<a[i];
cout<<endl;
}
return 0;
}