Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- cout << "Write your sentence: ";
- char str[100];
- cin.getline(str, 100);
- int lenstr = 0, lenword = 0, i, j, maxS = 0, id = 0;
- for(lenstr = 0;str[lenstr] != '\0';lenstr++){
- }
- int space = 0;
- for(i = 0;i < lenstr;i++){
- if (str[i] >= 'A' && str[i] <= 'z'){
- lenword++;
- }else if (lenword > maxS){
- maxS = lenword - space;
- id = i - maxS;
- lenword = 0;
- space = 0;
- }
- if (i == lenstr-1 && str[i] >= 'A' && str[i] <= 'z'){
- cout << "+" << endl;
- if (lenword > maxS){
- maxS = lenword - space;
- id = i - maxS + 1;
- lenword = 0;
- space = 0;
- cout << "++";
- }
- }
- for(j = 32;j < 64;j++){
- if(str[i] == char(j)){
- space++;
- }
- }
- }
- cout << endl;
- for(i=0;i < maxS;i++){
- cout << str[id];
- id++;
- }
- cout << endl << "Length stroke: " << lenstr << endl << "Maxs letter in word: " << maxS << endl << "id:" << id << endl <<"lenword: " << lenword << endl ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement