find the largest 3 digit number contained within the given number.

input:

6478434

output:

843

You can store the number in character array and use sliding window technique where size of window is 3 and then form numbers using a loop and simultaneously check for max number found till now. And at last you will have maximum 3 digit number.

#include<bits/stdc++.h>

#define ll long long int

#define MM endl

using namespace std;

int main()

{

```
int n;
cin>>n;
int sum=0;
int maxx=0;
int count=0;
int temp=n;
while (temp>0)
{
temp=temp/10;
count++;
}
int arr[count];
for (int i = count-1; i >= 0; i--)
{
arr[i]=n%10;
n=n/10;
}
for (int i = 0; i < count-2; i++)
{
for (int j = i; j < i+3; j++)
{
sum=sum*10+arr[j];
}
maxx=max(maxx,sum);
sum=0;
}
cout<<maxx;
```

}