Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- char str[1000];
- int i = 0;
- int Max = 0;
- int Maxpos = 0;
- int nomer = 0;
- cin.getline(str, 1000);
- while(str[i] != 0)
- {
- if((str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= 'a' && str[i] <='z'))
- {
- Maxpos++;
- }
- if (str[i + 1] < 'A' || (str[i + 1] > 'Z' && str[i + 1] < 'a') || str[i + 1] > 'z')
- {
- if((str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= 'a' && str[i] <= 'z'))
- {
- if(Maxpos > Max)
- {
- nomer = i + 1 - Maxpos;
- Max = Maxpos;
- }
- }
- }
- if(str[i] < 'A' || (str[i] > 'Z' && str[i] < 'a') || str[i] >'z')
- {
- Maxpos = 0;
- }
- i++;
- }
- Maxpos = 0;
- while(Maxpos < Max)
- {
- cout << str[nomer];
- nomer++;
- Maxpos++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement