getline ()
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
const int N = 1005;
const string ed = "***end***";
int main(void){
int maxn = 0;
string ans;
while (true){
string str;
getline(cin, str);
if (str == ed) break;
else{
if (str.size() > maxn){
maxn = str.size();
ans = str;
}
}
}
cout << maxn << endl << ans;
return 0;
}
getchar()
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const int N = 1005;
const char ed[10] = "***end***";
int main(void){
int maxn = 0;
char ans[101];
while (true){
char str[101];
int tag = 0, tep = 0;
char c;
while (c = getchar()){
if (c == '\n') break;
str[tag ++ ] = c;
tep ++ ;
}
str[tag] = '\0';
cout << str << endl;
if (!strcmp(str, ed)) break;
else{
if (tep > maxn){
maxn = tep;
strcpy(ans, str);
}
}
}
cout << maxn << endl << ans;
return 0;
}