#include <bits/stdc++.h> #define MAX 1000 using namespace std; int main(){ string data[MAX],n; int len = 0; int maxSize = -1,minSize = MAX; while(getline(cin,n)){ data[len++] = n; int s = n.size(); if(s > maxSize) maxSize = s; else if(s < minSize) minSize = s; } for(int i = 0; i < len; i++){ if(data[i].size() == minSize) cout<<data[i]<<endl; } for(int i = 0; i < len; i++){ if(data[i].size() == maxSize) cout<<data[i]<<endl; } }