Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- //void var_mat()
- //{
- // char s[100];
- // cin.getline(s,100);
- // char cuv[100][100];
- // int k=0;
- // char *p=strtok(s," ");
- // while(p)
- // {
- // strcpy(cuv[k],p);
- // k++;
- // p=strtok(NULL," ");
- // }
- //}
- //void citire_prop_cand_stim_nr()
- //{
- // char s[100];
- //// while(cin.getline(s,100))
- // {
- // blabla
- // }
- //}
- //void citire_prop_cand_stim_nr()
- //{
- // char s[100];
- // int n;
- // cin>>n;
- // cin.ignore();//sa nu ia enter ul de dupa nr de prop
- // //la fisier nu e nevoie
- // for(int i=1; i<=n; i++)
- // {
- // cin.getline(s,100);
- // }
- //}
- int main()
- {
- char s[100];
- cin.getline(s,100);
- int mx=-1;
- int k=0;
- int lng;
- char *p;
- p=strtok(s," ");
- while(p)
- {
- lng=strlen(p);
- if(mx<lng)
- {
- mx=lng;
- k=1;
- }
- else
- {
- if(mx==lng)
- {
- k++;
- }
- }
- p=strtok(NULL," ");
- }
- cout<<mx<<" "<<k<<".";
- return 0;
- }
- //eu dau bacalaureat la informatica
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement