/**********************************************************
 *     Code written by Akikaze                            *
 *     Duy-Bach Le, #Team4T's Chief Executor              *
 *     #Team4T Tertiary Flagship - Oblivion               *
 *                                                        *
 *     Written by a random fan of momocashew and Chiho    *
 *                                                        *
 *     Arigatougozaimasu, imouto-chan.                    *
 **********************************************************/

/************** [OPTIMIZATION PROTOCOL] **************/
#pragma comment(linker, "/stack:225450978")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
/*****************************************************/

/************** [LIBRARY PROTOCOL] **************/
#include <bits/stdc++.h>
using namespace std;
/************************************************/

/************** [LEGENDS/CONSTANTS] **************/
#define endl '\n'
#define i64 long long
#define ld long double
#define rsz resize
#define pub push_back
#define mp make_pair
#define fi first
#define se second
typedef vector<i64> vi;
typedef vector<ld> vd;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef pair<i64, i64> pii;
typedef pair<i64, pii> pip;
typedef pair<pii, i64> ppi;
const long long Mod = 1000000007LL, INF = 1e9, LINF = 1e18;
const long double Pi = 3.141592653589793116, EPS = 1e-9, Gold = ((1+sqrt(5))/2);
long long keymod[] = {1000000007LL, 1000000009LL, 1000000021LL, 1000000033LL};
long long keyCount = sizeof(keymod) / sizeof(long long);
/*************************************************/

/************** [BITWISE FUNCTIONS] **************/
template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcountll(s); }
/*************************************************/

/************** [MASTER CONTROLS - PHASE 1] **************/
auto TimeStart = chrono::steady_clock::now();
auto TimeEnd = chrono::steady_clock::now();
#define OImode 227420978
#define MultiTest 227420978

#undef OImode // Switch this off if submitting OI problems.
#undef MultiTest // Switch this off if submitting multi-test problems.

void ControlIO(int argc, char* argv[]);
void TimerStart();
void TimerStop();
void Exit();
/*********************************************************/

/************** [GLOBAL VARIABLES] **************/
string s; i64 n;
/************************************************/

/************** [FUNCTIONS] **************/

void Input() {
	cin >> s; n = s.size();
}

void Solve() {
	vector<vb> vis2(26, vb(26, false));
	vector<vector<vb>> vis3(26, vector<vb>(26, vb(26, false)));
	vector<vector<vb>> dp2(n, vector<vb>(26, vb(26, false)));
	vector<vector<vector<vb>>> dp3(n, vector<vector<vb>>(26, vector<vb>(26, vb(26, false))));
	vb possiblePrefix(n, false); possiblePrefix[n-1] = true;
	for (i64 i=n-1; i>=0; i--) {
		if (!possiblePrefix[i]) continue;
		if (i - 2 >= 4) {
			i64 x = s[i-1] - 'a', y = s[i] - 'a';
			if (!dp2[i][x][y]) {
				possiblePrefix[i-2] = true;
				vis2[x][y] = true;
				dp2[i-2][x][y] = true;
			}
		}
		if (i - 3 >= 4) {
			i64 x = s[i-2] - 'a', y = s[i-1] - 'a', z = s[i] - 'a';
			if (!dp3[i][x][y][z]) {
				possiblePrefix[i-3] = true;
				vis3[x][y][z] = true;
				dp3[i-3][x][y][z] = true;
			}
		}
	}
	vs A;
	for (i64 i=0; i<26; i++) {
		for (i64 j=0; j<26; j++) {
			for (i64 k=0; k<26; k++) {
				if (!vis3[i][j][k]) continue;
				string str = "";
				str += char(97+i);
				str += char(97+j);
				str += char(97+k);
				A.pub(str);
			}
		}
	}
	for (i64 i=0; i<26; i++) {
		for (i64 j=0; j<26; j++) {
			if (!vis2[i][j]) continue;
			string str = "";
			str += char(97+i);
			str += char(97+j);
			A.pub(str);
		}
	}
	sort(A.begin(), A.end());
	cout << A.size() << endl;
	for (auto x: A) cout << x << endl;
}
/*****************************************/

/************** [MAIN] **************/
int main(int argc, char* argv[]) {
	ControlIO(argc, argv);
	ios_base::sync_with_stdio(0); cin.tie(NULL);
	#ifndef MultiTest
		Input(); TimerStart();
		Solve(); TimerStop();
	#else
		int T; cin >> T; TimerStart();
		while(T--) {Input(); Solve();}
		TimerStop();
	#endif
	return 0;
}
/************************************/

/************** [MASTER CONTROLS - PHASE 2] **************/
void ControlIO(int argc, char* argv[]) {
	#ifdef Akikaze
	time_t t = time(0);
	tm* now = localtime(&t);
	cout << "Source code by #Team4T-Akikaze.\n";
	cout << "Current time: ";
	cout << (now->tm_year + 1900) << '-'
	     << (now->tm_mon + 1) << '-'
	     <<  now->tm_mday << " | "
	     <<  now->tm_hour << ":"
	     <<  now->tm_min << ":"
	     <<  now->tm_sec
	     << "\n\n";
	if (argc > 1) assert(freopen(argv[1], "r", stdin));
	if (argc > 2) assert(freopen(argv[2], "w", stdout));
	#elif OImode
	freopen("FILENAME.INP", "r", stdin);
	freopen("FILENAME.OUT", "w", stdout);
	#endif
}

void TimerStart() {
	#ifdef Akikaze
	TimeStart = chrono::steady_clock::now();
	#endif
}

void TimerStop() {
	#ifdef Akikaze
	TimeEnd = chrono::steady_clock::now();
	auto ElapsedTime = TimeEnd - TimeStart;
	cout << "\n\nTime elapsed: " << chrono::duration<double>(ElapsedTime).count() << " seconds.\n";
	#endif
}

void Exit() {
	TimerStop(); exit(0);
}
/*********************************************************/

/**********************************************************
 ti;.                               .:,:i:         :,;;itt;.        fDDEDDEEEEEEKEEEEEKEEEEEEEEEEEEEEEEE###WKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWW#WWWWWKKKKKEE      :,:.    f::::. .,ijLGDDDDDDDEEEEEEE
ti;.                               .:,:i:          .:,;itt;:      GLDEEGEEEEEEEEEEEEEEEEEEDEEEEEEEEEEE#W#WEKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWWWWWKKKKKKG.     .::.      f:,...,ijLGDDDDDDDDEEEEEE
ti;.                               .:,:i:            :,;;iti,    :fDDEEEEEEEEEEEEEEEKEEEEDEEEEEEEEEEEW##WEEEKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWWWWWWKKKKKKEG     .::.       .f,::,ijLGDDDDDDDDEEEEEE
ti;.                               .:,:i:             .,,;iti;.  LDDEEEEEEEEEEKEEEEWEEEDDEEEEEEEEEEE#WWWEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWWKKKKKEDj    .::.        .:L;;ijfGDDDDDDDDDEEEEE
ti;.                               .:,:i:              .:,;;iii:LLDEEEEEEEEEEEKEEEEEEEEDEEEEEEEEEEEW#WWEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKWWKWWWWWWWWWWWWWWKKKKKKKEL    .::.         .:;LijLGGDDDDDDDDEEEEE
ti;.                               .:,:;:                :,;;ittfDEEEEEEEEEEEEEEEEKEEEGEEEEEEEEEEEKWWWEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWKKKKKKKELj   .::.          :,;jffGGDDDDDDDDDEEEE
ti;.                               .:,:i:                 .,;;tGGDEEEEEEEEEEEKEEEKEEEDEEEEEEEEEEEEWWWEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWKWWWWWWKKKKKKKEEL   .::.          .:;itDGGDDDDDDDDDEEEE
ti;.                               .:::;:                   :;ifDEEEEEEEEEEEEKEEEKEEEEEEEEEEEEEEEWWWEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#WWWKKKKKKKKEEf   .::.           :,itfGEDDDDDDDDDDDEE
ti;.                               .:::;:                    :GGEEEEEEEEEEEKEKEEKEEEEEEEEEEEEEEEEWWEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#WKKKKKKKKKEEDG  .::.           .,;jfLGKDLDDDDDDEEDD
ti;.                               .:::;:                     fDEEEEEEKKKKKKKKKEKEEEEEEEEEEEEEEE#WEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#KKKKKKKKKKEEf .:::.           .,;tfLGDEDDDDDDDDEEE
ti;.                                :::;:                    fDEEEEEEKKKKKKKKKKWKEEEEEEEEEEEEEEEWKEEEEEEEEEEEEEEEEEEEEKEKKKKKKKKKKKKKKKKKKKKKKKKKKKKW##KKKKKKKKKEEft :::.           .,;tfLGDDDKDDDDDDDDD
ti;.                                .::;:                    fDEEEEEEKKKKKKKWKKKKKEEEEEEEEEEEEE#WEEWEEEEEDEEDEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#WKKKKKKKKEEGG :,:.           .,;tfLGGDDDKDDDDDDDD
ti;.                                .:.;:                   tGDEEEEKKKKKKKKKKKKKKKKKEEEEEEEEEEEWEEKWEEEEEEEDEEEEEEEEEEEEEEKEKKKKKKKKKKKKKKKKKKKKKKKKKKWWWKKKKKKKEEDf :::.           .,;tfLGGDDDDEDDDDDDD
ti;.                                .::;:                   fDEEEEEKKKKKKKKKKKWKKKKKKKKEEEEEEEWWEEWEEEEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKW##KKKKKKKEEEft.::.           .,;tfLGGDDDDDDEDDDDD
ti;.                                .:.;:                  tGDEEEKKKKKKKKKKKKKKKKKKKKKKEKEEEEE#EEWWEEEEEEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKW#WKKKKKKEEEGD:::.           .,;tfLGGDDDDDDDEDDDD
ti;.                                .:.,.                  LDEEEEKKKKKKKKKKWKWKKKKKKKKKKKKEEEKWEKW#EEEEEEEEEEEEEEEEKEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKW##KKKKKKEEEEf,,:.           .,;tfLGGDDDDDDDDEDDD
ti;.                               ..:.,.                 LGDEEEEKKKKKKKKKKWKKKKKKKKKKKKKKKKKWEEW#WEEEEEEEEEEEEEEEKEEEEEEEEEEEEEEEEEEEKEKKKKKKKKKKKKKKKK##KKKKKEEEEEfi;,.           .,;tfLGGDDDDDDDDDKDD
tt;.                                .:.,:                 jDEEEEKKKKKKKKKKWWKKKKKKKKKKKKKKKKKWKE#WWEEEEEEEEEEEEEEWEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKWWKKKKEEEEDfG;,:           .,;tfLGGDDDDDDDDDDKD
tii,.                               .:.,.                tGDEEEEKKKKKKKKKKWWWKKKKKKKKKKKKKKKWKKWWWKEEEEEEEEEEEEEKEEEEEEEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKW#KKKKEEEEDGGi;,.          .,;tfLGGDDDDDDDDDDDE
ti;;,:.                             .:.,:                fDEEEEKKKKKKKKKKKWKKKKKKKKKKKKKKKKKWEK#WWKEEEEEEEEEEEEDEEEEEEEEEEEEEEGEEEEEEEEEEEEEEEEEEEKKKKKKKWWKKEEEEEEDDf;;;,.         .,;tfLGGDDDDDDDDDDDD
tii;,,:..                           ...,.               ;LEEEEEKKKKKKWKKKKWKKKKKKKKKKKKKKKKKEKKW#WEEEEEEEEEEEEEjEEEEEEEEEKEEEEGEEEEEEEEEKEEEEEEEEEEEEEEEEE#WKEEEEEEDDf;;;;,:        .,itfLGGDDDDDDDDDDDD
ti;,,,,,:.                          ...,.               LDEEEEKKKKKKKKKKKWWWKKKKKKKKKKKKKKKWKK#W#WEEEEEEEEEEEDDLEEEEEEEEEWEEEEDEEEEEEEEEKEEEEEEEEEEEEEEEEEWWEEEEEEEDDfj,,,,,:.      .,itfGGGDDDDDDDDDDDD
tii,,,,::::.                        ...,:              .fDEEEEKKKKKKWKKKKWWWKKKKKKKKKKKKKKKEKKW#WWEEEEEEEEEEEKiKEEKEEEEEEWEEEEDEEEEEEEEEEEEEEEEEEEEEEEEEEEWWEEEEEEEDDLD:::,,,:.     .,ijfGGGDDDDDDDDDDDD
ti;:::::::::..                      .:.,:              LDEEEEKKKKKKKWKKKKWWKKKKKKKKKKKKKKKKtKKWWWWKEEEEEEEEEDiiDEEEEEEEEWWEEEEEEDEEEEEEEEEEEEEEEEEEEEEEEEEEWKEEEEEDDDGL:. .:,,,:    .,ijLGGGDDDDDDDDDDDD
tt;. .::::::::..                    ...,:             :fDEEEKKKKKKKKKKKKWW#KKKKKKKKKKKKKKKKfKKWWWWKEEEEEEEEDti,DEKEEEEEEWWEEEDEEEEEEEEEKEEEEEEEEEEEEEDEEEEE#WEEEEEGGDGf:.  .:,;,:.  .,ijLGGDDDDDDDDDDDDD
tt;.   .:::::::..                   ...,:             GDEEEKKKKKKKKWKKKKWWWKKKWKKKKKKKWWWKDEKLWWWWKKEEEEEEDEi,LDEEEEEEEEWWEEEEEEEEEEEEEEEEEEEEEEEEEDEDEEEEEW#EEEEDDDDGf,.    :,,,:...,ijLGGGDDDDDDDDDDDD
tt;.    .....::::..                 ...,:             fDEEEKKKKKKKKWKKKKWWWWKKKWKKKKKKKKKKfWKiWWW#KKEEEEEEEi;.EDfEEEDEEiWWEEEEEEEEEEEEDGKEEEEEEEEEEDEEEEEEEWWEEEEDDDGGLi.     .,;,:::,ijLGGGDDDDDDDDDDDD
tt;.      ....:::::.                ...,.            iDEEEEKKKKKKKKWKKWKWWWWWKKWWWKKKKKKKKtWKt#WWWKKEEEEEDji..DDKDDEDEGiWKEEEEEEEEEEDDEjEEEEEEEEEEEDEEEEEEEKWKEEDDDDGGff.      .:,;,,;ijLGGGDDDDDDDDDDDD
tt;.        ....::::..              .:.,:           .LDEEEKKKKKKKKKKKKWWWWKWWWWWWWWWWKKKKWtKKiDWWWKKKEEEEKi:..DEDDDDDDiiWKEEEEEEEEEEDDEijDEEEEEKEEEEEEEEEEEEWWEEGDDDGGLG.       .:,;;iijLGGGDDDDDDDDDDDD
tt;.          .....:::..            ...,.           .fEEEEKKKKKKKKWKKKKWWWWWWWWWWWWWWKWKKKiKDiLWWWWKEEEEEi,..fD:DDDDDti;WEEEEEEEEEEKDDi:iDDEEEEWEEEEEEEEEEEE#WEEGDDDDGGG.         :,iitjLGGGDDDDDDDDDDDD
tti.            .....:::..          ...,.           GDEEEKKKKKKKKKWKKKWWW#WWWWWWWWWWWKWKKjiEjitWWWKKWEEEDi...DDLDDDDji;;WEEEEEEEEEEEDEj.iDDEEEEWEEEEEEEEEEEEWWEEDDDDDDGf.          .,;tjfLGGDDDDDDDDDDDD
tti.              ....::::..        ...,.           fEEEKKKKKKKKKKKKKKKW#WWWWWWWWWWWWWWWWtiEiiiWWWKKEWKEi....D.EDDDEi;.fWEEEEEEEEEEDDfL.;EDDEEEWEEEEEEEEEEEEWWEEEDDDDDGf.           :;ijfLGGDDDDDDDDDDDD
tti.                ....::::..      ...,.          LDEEEKKKKKKKKKKKKKKWWWWWWWWWWWWWWWW####WKiiiWWWKKKEEK,...:E:DDDEii..GWEEEEEEEEDWDDiL.,KDDEEEWEEEEEEEEEEEEWWKEEDDDDDGf:           .,itfLGGDDDDDDDDDDDD
tti.                 .....:::..     ...,.          fDEEEKKKKKKKKKWKKKKWWWWWWWWWWWWW########WLiiWWWKKKEEjD...G,DDDDi;...EWEEEEEEEEDKDEii..LDDEEEWEEEEEEEEEEEEWWWEEDDDDDGfi           .,;tfLGGGDDDDDDDDDDD
tti.                   .....:::..   ...,.         iGEEEKKKKKKKKKKWKKKKWWWWWWWWWWWW###########KiWWWKKEEE,.D..D.DDDii:...KKEEEEEEEEEDDj:...tEDEEEWEEEEEEEEEEEEWWWEEEDDDDDLL           .,;tjLLGGDDDDDDDDDDD
tti.                     ....::::......:.         LEEEKKKKKKKKKKWWKKKWWW#KWWWWWWWW#####W####W##KWWKKEEL..:D.jjDDi;,....KKEEEEEEEDfDDi...:iKDEEEWKEEEEEEEEEEEWWWEEEEDDDDLG           .,;tjLLGGDDDDDDDDDDD
tti.                        ...::::::..,.        :GEEEKKKKKKKKKKKKWWWWW##WWWWWWWWW##WKWK#W#W####WWKEEK.....G.DDti,.....KKEEEEEEDWGDf.,...iKDEEEWWEEEEEEEEEEEW#WEEEEEDDDGL           .,;tjLLGGDDDDDDDDDDD
tti.                         ....::::::,.        GDEEKKKKKKKKKKKKKWWWW###WWWWWWWWWW#WWWK###W#####WKEKK.....jDDL;;......KKEEEEEEEEEDi.f...;KDEEEWWEEEEEEEEEEEWWWWEEEEEDDGf           .,;tjLLGGDDDDDDDDDDD
tti.                           ....:::,,.       .LEEEKKKKKWKKKKKWWWWWW###WWWWWWWWWW#WWKW#WW##W#WWWKEKD:....:DD:;......;KEEEEEEEKiDD..f...,KKEEEWWEEEEEEEEEEEWWWWEEEEEDDDf           .:;tjLLGGGDDDDDDDDDD
tti.                             ...::,,,:.     GDEEKKKKKKKKKKKKWWWWWWW#WWWWWWWWWWW#KjKWWWWWWWWWWWWEK.j,..;fD.;.......fKEEEEEDKG:Di..,....DKEEEWWEEEEEEKEKKKWWWWEEEEEEDDf           .:;tjLLGGDDDDDDDDDDD
jti.                              ...::,,,,:.  .fEEEKKKKKWKKKKKKWWWWWWW#WWWWWWWWWWK#KKKWWWWWWWWWWWWWK..f:.:G.,:.......EKEEEEEKK;:E:.......fKEEEWWKEKEKKKKKKKW#WWEEEEEEDDf:          .,;tfLLGGDDDDDDDDDDD
tti.                               ...:,,,;;,: iDEEKKKKKWKKKKKKKWWWWWWW#WWWWWWWWWWK#WDKWWKKWWWWWWWWWE..;G:G..,........KKEEEEEKi.Gi..:.....tKEEKWWWKKKKKKKKKKW##WKEEEEEEDfi          .,;tfLLGGGDDDDDDDDDD
tti.                               ....::,,;;;,LEEKKKKKKWKKKKKWWWWWWW###WWWWWWWWWWKWWDKWEEEWKKWWWWWKKj.:LG..;.........EKEEEEKG;.G...;.....;KKEKWWWKKKKKKKKKKW##WWKEEEEEDfL          .,;tfLGGGDDDDDDDDDDD
jti.                                ...::::,;ijDEEKKKKKWKKKKKKWKWWWWW##WWWWWWWWWWWKK#KKGDGDWEEWKKWKKGE,.i;.:.........:EKEEEKE;.:L...j.....,KWEKWWWKKKKKKKKKK####WKKEEEEDLG          .,;tfLGGGGDDDDDDDDDD
jti.                                ...:...,,;GEEKKKKKWWKKKKKWWWWWWWW###WWWWWWWWWKKKWWKiLGGEDEDEKGKKiEG..;...........jKEEEKK;:.G....,.....:KKEWWWWKKKKKKKWKK####WKKKKEEEGL          .,;tfLGGGGDDDDDDDDDD
jti.                                ...:.  .:,GEEKKKKKWKKKKKWWWWWWWW####WWWWWWWWWKKKWWKii;fDLGDK: EEi:E:.............EKEEKK;;..L...........KKKWWWWKKKKKKKWKK####WKKKWKEEDf          .,;tfGGGGDDDDDDDDDDD
jti.                                ...:.    ,EEKKKKKWWKKKKKWWWWWWWWW###WWWWWWWWKKKKfWWLt;i,. fi  EG..D:.............EKEKK;;..t....:.......KWKWWWWKKKKKKKWKK####WKKKWEEEDf:.        .,;tfGGGGDDDDDDDDDDD
jti.                                ...:.    GEEKKKKKWKKKKKWWWWWWWWW####WWWWWWWKKKKKt;KKEfff     .;t.................KKKKi;:..GtGGfG.......KWWWWWWKKKKKKKWKK###WWWKKKKEEEf,,:       .,;tfGGGGDDDDDDDDDDD
jti.                                ...:.    GEKKKKKWWKKKKKWWWWWWWWWW##WWWWWWWKKKKKKt;EiKKKK,   ...t................jEKKG;;..,.....,LGi....KWWWWWWKKKKKKWKKKW####WKKKKKEEL,,,:.     .,;tfGGGDDDDDDDDDDDD
jti.                                ...:.  .GEEKKKKKWKKKKKWWWWWWWWWW###WWWWWWWKKKKKKtiE::tGG........................EEEj;;...,.........:D..DKWWWWWWKKKKK#KKW###W#WKKKKKEEfj:,,,:.   .,;tfGGGDDDDDDDDDDDD
jti.                                ...:.   DEKKKKKWWKKKKKWWWWWWWWW####WWWWWWWKKKKKKiiE:::.::.......................EEi;;...j.....f......:iDKWWWWWWKKKKK#WW######WKKKKKEELG :,,,,:. .,;tfGGGDDDDDDDDDDDD
jti.                                ...:.  fEEKKKKWWKKKKWWWWWWWWWWW###WWWWWWWWKKKKKK;tE::..........................DD;.;,.::......;........EWWWWWWWKKKKW#WW#####WWKKKWKKELG  .:,,,:::,;tfGGGDDDDDDDDDDDD
jti.                                ...:. .DEKEKKKWWKKKKWWWWWWWWWWW###WWWWWWWWKKKKKE,iD::..........................D..,;.,;tLffi...........DWDWWWW#KKKWWWWW#####W#KKKWKEEGL    .:,;,,,;tfGGGDDDDDDDDDDDD
jti.                                ...:. ;EEKKKKWWKKKKKWWWWWW#WWWW####WWWWWWKKKKKEL:iD:..........................j ..;..;;:.....i,........DKtWWWWWKKWWWWWW#####WWWKKKEKEDf     .:,;;;itfGGGDDDDDDDDDDDD
jti.                                ...:. DEKKKKKWWKKKKWWWWWWW#WWWW####WWWWWWKKKKKEj:iG...............................:....................GKiWWWWWKKWW#WWW######WWKKKKKEEf       .,;iitfGGGDDDDDDDDDDDD
jti.                                ...:.:EKKKKKWWKKKKKWWWWWWW#WWW#####WWWWWKWKKKKEi:if:.................................iEKEKKKKKKDj......DKiWWWWWKWK##WW#######WWKKK:KEEL        .:;itfGGGDDDDDDDDDDDD
jji.                                ...:,DEEKKKWWWKWKKWWWWWWWWWWWW#####WWWWWWWKKKKEi:it..................................j.  KKKKKKKKKKKf..DKiWWWWWKWW##WW#######WWKKK,KEEf         .,;tfGGGDDDDDDDDDDDD
jji.                                ..L:iDEEKKKWWKKKKKWWWWWWWWWWWW#####WWWWWKWKKKKKi.i;..................................  . KKKWWWWWWWWK..DGiWWWWWKK##WWW#####W#WWKKKjEKEL,        .:;tfGGGDDDDDDDDDDDD
jji.                               .f:::EEEKKKWWWKKKKKWWWWWWWWWWWW#####WWWWWKWKKKKK;.i,.................................::  KKEKWWWWWWfWK..EiiWWWWWKWW#WW##########KKKD,KELj        .:;tfGGDDDDDDDDDDDDD
jji.                             .t::::,DEEKKKWWKKKKWWWWWWWWW#WWWW#####WWWWKKWKKKEK;.i:.................................GDDEEEKKKWWWWWtWWD.E;iWWWWWW###WW#########WWKKK.EEDG        .:;tfGGGDDDDDDDDDDDD
jji.                          . j..::::EKEKKKWWWKKKKWWWWWWWWW#WWW######WWWWKKWKKKEK;.t:.................................ELLEDDEEEWWWWEtWK,.KiiWWWWWW###W##########WWKKK:EEEG     .;tjfLLGDDDDDDDDDDDDDDD
jji.                          i.::::::,EEEKKWWWKKKKKWWWWWWWWW#WWW#####WWWWWKWKKKKEE,.t..................................DfiEGDDDEEKKKttKWG.KiiWWWWW##WWW##########WWKKK:fEEL  ,fGGGDDDDDDDDEEEDDDDDDDDDD
jji.                        .;:..:::::DEEEKKWWWKKKKKWWWWWWWWW#WWWW####WWWWWWWKKKKED,.t..................................ifjDDGGEGDKK.ttKKE.DiWWWWW###WW##########WWWKKK:.KELiLGGGGDDDDDDDDDDDDEEEDDDDDDD
jji.                       i.:.::::::,KEEKKWWWKKKKKKWWWWWWWWW#WWWW####WWWWWWWKKKKEL:.j..................................GGf,;ifLLED .iiKKi:fWWWWWW##W#W##########WWWKKK:.KKLGGDDDDDDDDDDDDDDDDEDDEEDDDDD
jji.                     .j:.::::::::EEEKKKWWWKKKKKKWWWWWWWW##WWW#####WWWWWWWKKKKKf:.f..................................:EEfftf .,. ;iE,..jWWWWWWW###W############WWKKK,:KKGDDDDDDDDDDDDDDDDDDDDDDDEDDDD
jji.                    .:.::::::::,,EEEKKWWWKKKKKKKWWWWWWWW##WWW#####WWWWWWWKKKKKt..G....................................EEELL;   .j....tKWWWWWWW################WWWKKtfGKGEDDDDDDDDDDDDDDDDDDDDDDDEEDD
jji.                   :...:::::::,,jEEKKWWWWKKKKKKWWWWWWWWW##KWW#####KWWWWWWKKKKEi..D....................................:jEEE.........;KKWWWWWWWW#WW##W##########WWKKDLGKEKDDDDDDDDDDDDDDDDDDDDDDDDDED
jji.                  i:.::::::::,,,EEEKKWWWWKKKKKWWWWWWWWWW##WWW#####WWWWWWWKKKKKi..D......................................:::::......,KKKWWWWWWWWW#####W########WWWKKKGGKKEGGGGGGGGDDDDDDDDDDDDDDDDDDE
jji.                 i..:::::::::,,tEEKKWWWWKKKKKWWWWWWWWWWW##WW######WWWWWWWKKKKKi..D......................................::::......:EKKKWWWWWWWWWWW##WW########W#WKKWGGKKGGGGGGGGGGGGGGGDDDDDDDDDDDDD
jji.                .:::::::::::,,,EEEKKWWWWKKKKKWWWWWWWWWWW##WW#####WWWWWWWWKKKKKi..D....................................:::::::::..tELii;KWWWWWWWWWW##WW######WWWWWWKWGGGKGGGGGGGGGGGGGGGGGGGGGGGGGGDG
jjt.                :.::::::::,,,,fEEKKWWWWKKKKKKWWWWWWWWWW###WW####WWWWWWW#WKKKKKi..D....................................:::::::.:.,;;;;;;,KKWWWWWWWWW#WW########WWWKKWGGGKGGGGGGGGGGGGGGGGGGGGGGGGGGGG
jji.               ;.::::::::,,,,;EEEKWWWWWKKKKKWWWWWWWWWWWW##WW###WKWWWWWK#WKKKKKi..G......................................:::::::,;;;;:...KKKWWWWWWWWWKWW#######WWWWKKGLGKDGGGGGGLLGGGGGGGGGGGGGGGGGGG
jjt.              f.:::::::::,,,,fEEKKWWWWWKKKKKWWWWWWWWWWW###WW##WKKWWWWWW#WKKKKK;.jt........i.............................:::::::;j;;....:E.KKKWWWWWWWKWW#####W#WWWWKKLLGWEEGGGGGLGGGGGGGGGGGGGGGGGGGG
jjt.             ...:::::::,,,,,;DEEKWWWWWKKKKKWWWWWWWWWWWW####WWWKKKWWWWWWWWKKKKK;.E;.........t.............................:::::ii;;.....D...KKWWWWWWWKWW#####WWEWWWKKGGGEKKGGGGGLGGGGGGGGGGGGGLGGGGGG
fji.             ;.:::::::,,,,,;LEEKKWWWWWKKKKKWWWWWWWWWWWW####KWKKKKWWWWWWWWKKKKKi.D;..........j.............................:::tt;,.....:.....KKWWWWWWKWWWW##WWWGWWWKKGGGGKEGGGGGGGGGGGGGGGGGGGLLGGGGL
fji.            t::::::::,,,,,,;EEEKWWWWWKKKKKKKWWWWWWWWWWW##WKWKKKKKWWWWWWWWKKKKKi:D;............j...........................::LL;,.............KKWWWWWKWWWWWWWWWGWWWKKGGGGKGGGGGGGGGGGGGGGGGGGGLLGGGGL
fjt:            .:::::::,,,,,,,DEEKWWWWWWKKKKKKKWWWWWWWWWWWWKKWKKKKKKWWWWK#WWKKKKWitE;........... ............................:G;;:...............KKKWWKKWWWWWWWWWGWWWKKGGGGWGGGGGGGGGGGGGGGGGGGGGGGGGGL
fjji;:.       .f:::::::,,,,,,,;EEEKWWWWWWKKKKKKWWWWWWWWWWWKKKKKKKKKKKWWKWWWWWKKKKWGKD;........................................L;;..................DKKWKKWWWWWWWWWGWWWKKDGGGKDGGGGGGGGGGGGGGGGGGGGGGGGGG
fjjtii;,:.     :::::::,,,,,,,;EEEKWWWWWWKKKKKKWWWWWWWWWWKKKKKKKKKKKKWWWWWW#WWKKKKWiEj;......................................:i,;....,...............;KKEKWWWWWWWWWGKWWKKDDGGDEGGGDGGGGGDGGGGGGGGGGGGGGGG
fjtiiiii;;:.  j::::::,,,,,,,;;EEEKWWWWW#KKKKKWWWWWWWWWKKKKKKWKKKKKKKWWWWWWWWWKKKKWtEL;:....................................;;;:...,;j................:KEEWWWWWWWWWDDWWKKDDDDDKDDDDDDDDDDDDDDDGGGGGGGGGGG
fjti;;iiii;;,:::::::,,,,,,,,;EEEKWWWWWWWKKKKWWWWWWWWKKKKKKKWKKKKKKKWWWWWWW#W#KKKKWEEii;...................................f;:....,;L...................EEKWWWWWWWWDDWWKKDDDDDKEDDDDDDDDDDDDDDDDDDDDDGGGG
fjt,,,;;;;ii;f::::::,,,,,,,;;EEKWWWWWWWKKKKKWWWKWWKKKKKKKKKKKKKKKKKWWWWWWW#W#KKKKWKEij;:...............................:G;,.....,;f....................:tKKWWWWWWWDDWWKKDDDDDKKDDDDDDDDDDDDDDDDDDDDDDDDD
jjt. ..:,;;;;,::::,,,,,,,,;;GEEWWWWWWWWKKKKWKKWKKKKKKKKKKKKKKKKKKKKWWWWWWW#W#KKKKWEDi;j;............................,Li;L;;;..,;;f........................KKKKWWWKDDWWKKDDDGDKKGGGGGGGGDGDDDDDDDDDDDDDDD
fjt.    .:,,,:::::,,,,,,,;;;EEKWWWWWWWKKKKKKWKKKKKKKKKKKKKKKKKKKKKWKKKWKW##W#KKKKWEti;;G;........................tEEEL;;;;;;;;;;L..........................DKKKKKEDDWWKEDGftiLE;;;;itjLGGGGGGDDDDDDDDDDD
fjt.       .j::::,,,,,,,;;;DEEWWWWWWWWKKKKWKKKKKKKKKKKKKKKKKKKKKKKWKKWWWK##W#KKKKKEii;;;L;...................iDEEEEEEKKi;j;;;;jD.....:......................,KKKKDGGEKKE:::::;E::::::::::,tLGGDDDDDDDDDD
fjt.       .;:::,,,,,,,;;;;EEKWWWWWWWWKWKKKKKKKKKKKKKKKWKKKKKKKKKKWKKWWWW#WW#KKKKKKii;;;;f;.............:tDEEEEEKKKKKKKKEti;;;L...............................EEKf;:iKKE::::::E::::::::::::::ifDDDDDDDDD
fjt:        :::,,,,,,,,;;;DEEWWWWWWWWWEKKKKKKKKKKKKKKKKKKKKKKKKKKWWKKWWWW####KKKKKEiii;;;;f,.........iDEEEEKKKKKKKKKKKKKKKf;iG......i..........................fK::::KKE::::::E::::::::::::::::,tGGDDDDD
fjt:       t:::,,,,,,;;;;iDEKWWWWWWKEKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWKKWWWW####WKKKKLiii;;;;;L,....,Li;EDEEEEKKKKKKKKKKKKKKKKiG......;:...........................:i:::KKE:::::,E,::::::::::::::::::iGDDDD
jjt.       f::,,,,,,,;;;;GEEWWWWKEEKEKKKKKKKKKKKKKKKKWKKKKKKKKKKKWWKWWWWW###WWKKKKiii;;;;;;;G,;L;;iiEEEEEEEKKKKKKKKKKKKKWWKE......;t.........:....................j::KEE:,::,,D,,::::,,,,,,:::::::::tDDD
fjt:.      ,::,,,,,,,;;;;EEWWKEEEEEEKKKKKKKKKKKKKKKKWKKKKKKKKKKKWWKKWWWWW#W#KKKKKKiiiiii;;;;;i;;iiiEEKEEKKWKKKKKKKWKKKKKWWWGi;...;t......,;;;;,....................:,EEE,,,,,,D,,,,,,,,,,,,,,,,::,::::tG
fjt:.     ,::,,,,,,,;;;;DEKEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWW#W#KKKKKKiiiii;;i;;;;;iiiKKKEKKKKWWKWWWWWWKKKKWWWWW;;;:;L.....;;;;;;;;;....................,KEE,,,,,,E,,,,,,,,,,,,,,,,,,,,,,,,;
fjt:.     f:,,,,,,,;;;;jEDEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWW#W##KKKKKKiiiiiiii;i;;iiiEKKKKKKKKWKWWWWWWWWKKKWWWWWKi;;i.....,jEEfGi;;;;;...................EED,,,,,,E,,,,,,,,,,,,,,,,,,,,,,,,,
fjt:.    .f::,,,,,,;;jEEDEEEEEEEEEEKKKKKKKKKKKKKKKWKKKKKKKKKKKKKWWWKWWWWW###KKKKKLiiiiiiiiiiiiiiEEKKKKKKKKWWWWWWWWWWWWKWWWWWWGi;i;,..;jDDDKEGi;;;;;;:................EED,,,,,,D,,,,,,,,,,,,,,,,,,,,,,,,,
fjt:.  .. ;::,,,,,;;EDDEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWKKW#WW####KWKKKiiiiiiiiiiiiijKKKKKKKKKKWWWWWWWWWWWWWWWWWWWWWt;i;;;;i;DDDDDDGi;;;;;;;;:.............EDf;,,,;,G;;;;;;;;;;;;;;;,,,,,,,,,,
fjt:......:,,,,,,;LDDDEEEEEEEEEEEKKKKKKKKKKKKKKKKWKKKKKKKKKKKKKWWWWKWWWW####KKKKKiiiiiiiiiiijKEKKWKKKKKKKWWWWWWWWWWWWWWWWWWWWWWiLiii;i;DEEEEDDE;i;;;;;;;;;:..........EDi,;;;;;L;;;;;;;;;;;;;;;;;;,,,,,,,
fjt:......:,,,,,;EDDDEEKEEEEEEEEEKKKKKKKKKKKKKKKWKKKKKKKKKKKKKKWWWWKKWWW##W#KWKKWEiiiiiijGKKKKKWWKKKKKKKKWWWWWWWWWWWWWWWWWWWWWWKi;iiiiDDEEEEEEDEi;;;;;;;;;;;;;,:.....ED;;;;;;;j;;;;;;;;;;;;;;;;;;;;;;;,,
fjt:.....t,,,,,;DDDDEEEKEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWKKKWWWW##WKWKKWKiiiKKKKKKKKKWWKKKKKKKKWWWWWWWWWWWWWWW#WWWWWWWWWiiiiifLEEEEEEEEDi;i;;;;;;;;;;;;.....DD;;;;;;;i;;;;;;;;;;;;;;;;;;;;;;;;;
fjt:.....G,,,,,GDDDEEEEEEEEEEEEKKKKKKKKKKKKKKKKWKKKKKKKKKKKKKKKWWWKKKWWW###WKWKKWKitKKKKKKKKKWKKKKKKKKKKWWWWWWWWWWWWWW###WWWWWWWWEiiiiiiiEEEEEEEEDGiiii;;;;;;;;;.....GD;;;;;;;i;;;;;;;;;;;;;;;;;;;;;;;;;
fjt:.....L,,,,;GDDDEEEEEEEEEEKEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWDGWWW###KKWWKWKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWW####WWWWWWWWWiiiiiiiiEEEEEEEEEEDi;i;;;;;;;;.....Lj;;;;;;i;iiiiii;;;;;;ii;;;;;;;;;;;
 **********************************************************/


/* Arthur Conmy / arthurconmy */
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <random>
#include <stack>
#include <deque>
#include <chrono>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef pair<int,int> pii;
#define REP(i, a, b) for (int i = int(a); i <= int(b); i++)
#define REPb(j, d, c) for (int j = int(d); j >= int(c); j--)
#define ff first
#define ss second
#define pb push_back
#define len(x) int((x).size())
#define endl "\n"

bool works[10000];

int main() // LL OR INT??
{
	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	string s;
	cin>>s;

	works[s.size()-1]=1; // where the suffix ends

	vector<string> answers;

	REPb(i,s.size()-3,4)
	{
		if(i+2<=len(s)-1 && works[i+2]) // try to place a 2-x
		{
			if(i+2==len(s)-1) // the first 2
			{
				works[i]=1;
				answers.pb(s.substr(i+1,2));
			}

			if(i+4<=len(s)-1)
			{
				// try 2-2

				if(s[i+1]!=s[i+3] || s[i+2]!=s[i+4])
				{
					works[i]=1;
					answers.pb(s.substr(i+1,2));
				}
			}

			if(i+5<=len(s)-1)
			{
				if(works[i+5])
				{
					works[i]=1;
					answers.pb(s.substr(i+1,2));
				}
			}
		}

		if(i+3<=len(s)-1 && works[i+3])
		{
			if(i+3==len(s)-1)
			{
				works[i]=1;
				answers.pb(s.substr(i+1,3));
			}

			if(i+5<=len(s)-1)
			{
				// try a 3-2

				if(works[i+5])
				{
					// if(i==8) cout << "HELLO" << endl;

					works[i]=1;
					answers.pb(s.substr(i+1,3));
				}
			}

			if(i+6<=len(s)-1)
			{
				if(s[i+1] != s[i+4] || s[i+2] != s[i+5] || s[i+3] != s[i+6])
				{
					works[i]=1;
					answers.pb(s.substr(i+1,3));
				}
			}
		}
	}

	if(answers.empty())
	{
		cout << 0 << endl;
		return 0;
	}

	sort(answers.begin(),answers.end());
	vector<string> real_answers = {answers[0]};

	REP(i,1,len(answers)-1)
	{
		if(answers[i]!=answers[i-1])
		{
			real_answers.pb(answers[i]);
		}
	}

	cout << real_answers.size() << endl;

	for(auto a:real_answers)
	{
		cout << a << endl;
	}
}


/* Arthur Conmy / arthurconmy */
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <random>
#include <stack>
#include <deque>
#include <chrono>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef pair<int,int> pii;
#define REP(i, a, b) for (int i = int(a); i <= int(b); i++)
#define REPb(j, d, c) for (int j = int(d); j >= int(c); j--)
#define ff first
#define ss second
#define pb push_back
#define len(x) int((x).size())
#define endl "\n"

bool works[10000];

int main() // LL OR INT??
{
	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	string s;
	cin>>s;

	works[s.size()-1]=1; // where the suffix ends

	vector<string> answers;

	REPb(i,s.size()-3,4)
	{
		if(i+2<=len(s)-1 && works[i+2]) // try to place a 2-x
		{
			if(i+2==len(s)-1) // the first 2
			{
				works[i]=1;
				answers.pb(s.substr(i+1,2));
			}

			if(i+4<=len(s)-1)
			{
				// try 2-2

				if(s[i+1]!=s[i+3] || s[i+2]!=s[i+4])
				{
					works[i]=1;
					answers.pb(s.substr(i+1,2));
				}
			}

			if(i+5<=len(s)-1)
			{
				works[i]=1;
				answers.pb(s.substr(i+1,2));
			}
		}

		if(i+3<=len(s)-1 && works[i+3])
		{
			if(i+3==len(s)-1)
			{
				works[i]=1;
				answers.pb(s.substr(i+1,3));
			}

			if(i+5<=len(s)-1)
			{
				// try a 3-2

				works[i]=1;
				answers.pb(s.substr(i+1,3));
			}

			if(i+6<=len(s)-1)
			{
				if(s[i+1] != s[i+4] || s[i+2] != s[i+5] || s[i+3] != s[i+6])
				{
					works[i]=1;
					answers.pb(s.substr(i+1,3));
				}
			}
		}
	}

	sort(answers.begin(),answers.end());

	for(auto a:answers)
	{
		cout << a << endl;
	}
}


/* Arthur Conmy / arthurconmy */
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <random>
#include <stack>
#include <deque>
#include <chrono>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef pair<int,int> pii;
#define REP(i, a, b) for (int i = int(a); i <= int(b); i++)
#define REPb(j, d, c) for (int j = int(d); j >= int(c); j--)
#define ff first
#define ss second
#define pb push_back
#define len(x) int((x).size())
#define endl "\n"

bool works[10000];

int main() // LL OR INT??
{
	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	string s;
	cin>>s;

	works[s.size()-1]=1; // where the suffix ends

	vector<string> answers;

	REPb(i,s.size()-3,4)
	{
		if(i+2<=len(s)-1 && works[i+2]) // try to place a 2-x
		{
			if(i+2==len(s)-1) // the first 2
			{
				works[i]=1;
				answers.pb(s.substr(i+1,2));
			}

			if(i+4<=len(s)-1)
			{
				// try 2-2

				if(s[i+1]!=s[i+3] || s[i+2]!=s[i+4])
				{
					works[i]=1;
					answers.pb(s.substr(i+1,2));
				}
			}

			if(i+5<=len(s)-1)
			{
				works[i]=1;
				answers.pb(s.substr(i+1,2));
			}
		}

		if(i+3<=len(s)-1 && works[i+3])
		{
			if(i+3==len(s)-1)
			{
				works[i]=1;
				answers.pb(s.substr(i+1,3));
			}

			if(i+5<=len(s)-1)
			{
				// try a 3-2

				works[i]=1;
				answers.pb(s.substr(i+1,3));
			}

			if(i+6<=len(s)-1)
			{
				if(s[i+1] != s[i+4] || s[i+2] != s[i+5] || s[i+3] != s[i+6])
				{
					works[i]=1;
					answers.pb(s.substr(i+1,3));
				}
			}
		}
	}

	if(answers.empty())
	{
		cout << 0 << endl;
		return 0;
	}

	sort(answers.begin(),answers.end());
	vector<string> real_answers = {answers[0]};

	REP(i,1,len(answers)-1)
	{
		if(answers[i]!=answers[i-1])
		{
			real_answers.pb(answers[i]);
		}
	}

	cout << len(real_answers) << endl;

	for(auto a:real_answers)
	{
		cout << a << endl;
	}
}


#include<bits/stdc++.h>
#define int long long int
#define pll pair<int,int>
#define dbl long double
#define ff first
#define ss second
#define endl "\n"
#define PI acos(-1)
#define mod 998244353
#define eps 0.00000001
#define INF 1000000000000000001
#define all(x) (x).begin(),(x).end()
#define LB(v,x) (lower_bound(all(v),x) - v.begin())
#define UB(v,x) (upper_bound(all(v),x) - v.begin())
#define size(x) (int)(x).size()
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define popb() pop_back()
#define popf() pop_front()
#define mp(x,y) make_pair((x),(y))
#define vec(dt) vector<dt>
#define vv(dt) vector<vector<dt>>
#define count_set_bits(x) __builtin_popcount(x)
#define fastio(x) ios_base::sync_with_stdio(x); cin.tie(NULL)
#define init(v,s) memset(v,s,sizeof(v))
#define bug(x) cerr<<"LINE: "<<__LINE__<<" || click to see test details "<<#x<<" = "<<x<<endl
#define loop(i,s,n) for(int i=s;i<n;i++)
#define print(v) for(auto it:v) cout<<it<<" "; cout<<endl
using namespace std;

string f(string a)
{
	string x = a;
	reverse(all(x));
	return x;
}

signed main()
{
	fastio(0);

	string s;
	cin>>s;
	reverse(all(s));
	int dp[size(s)][4];
	init(dp,0);
	set<string> st;
	if(size(s)>=7)
	{
		dp[1][2] = 1;
		st.insert(f(s.substr(0,2)));
	}
	if(size(s)>=8)
	{
		dp[2][3] = 1;
		st.insert(f(s.substr(0,3)));
	}
	loop(i,3,size(s)-5)
	{
		if(dp[i-2][2]==1 && s.substr(i-3,2)==s.substr(i-1,2)) dp[i][2] = 0;
		else if(dp[i-2][2]==1 || dp[i-2][3]==1)
		{
			dp[i][2] = 1;
			st.insert(f(s.substr(i-1,2)));
		}

		if(i>=5 && dp[i-3][3]==1 && s.substr(i-5,3)==s.substr(i-2,3)) dp[i][3] = 0;
		else if(dp[i-3][2]==1 || dp[i-3][3]==1)
		{
			dp[i][3] = 1;
			st.insert(f(s.substr(i-2,3)));
		}
	}

	cout<<size(st)<<endl;
	for(auto it:st) cout<<it<<endl;

 	return 0;
}


#include<bits/stdc++.h>
#define int long long int
#define pll pair<int,int>
#define dbl long double
#define ff first
#define ss second
#define endl "\n"
#define PI acos(-1)
#define mod 998244353
#define eps 0.00000001
#define INF 1000000000000000001
#define all(x) (x).begin(),(x).end()
#define LB(v,x) (lower_bound(all(v),x) - v.begin())
#define UB(v,x) (upper_bound(all(v),x) - v.begin())
#define size(x) (int)(x).size()
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define popb() pop_back()
#define popf() pop_front()
#define mp(x,y) make_pair((x),(y))
#define vec(dt) vector<dt>
#define vv(dt) vector<vector<dt>>
#define count_set_bits(x) __builtin_popcount(x)
#define fastio(x) ios_base::sync_with_stdio(x); cin.tie(NULL)
#define init(v,s) memset(v,s,sizeof(v))
#define bug(x) cerr<<"LINE: "<<__LINE__<<" || click to see test details "<<#x<<" = "<<x<<endl
#define loop(i,s,n) for(int i=s;i<n;i++)
#define print(v) for(auto it:v) cout<<it<<" "; cout<<endl
using namespace std;

string f(string a)
{
	string x = a;
	reverse(all(x));
	return x;
}

signed main()
{
	fastio(0);

	string s;
	cin>>s;
	reverse(all(s));
	int dp[size(s)][4];
	init(dp,0);
	set<string> st;
	if(size(s)>=7)
	{
		dp[1][2] = 1;
		st.insert(f(s.substr(0,2)));
	}
	if(size(s)>=8)
	{
		dp[2][3] = 1;
		st.insert(f(s.substr(0,3)));
	}
	loop(i,3,size(s)-5)
	{
		if((dp[i-2][2]==1 && s.substr(i-3,2)!=s.substr(i-1,2)) || dp[i-2][3]==1)
		// else if(dp[i-2][2]==1 || dp[i-2][3]==1)
		{
			dp[i][2] = 1;
			st.insert(f(s.substr(i-1,2)));
		}

		if((i>=5 && dp[i-3][3]==1 && s.substr(i-5,3)!=s.substr(i-2,3)) || dp[i-3][2]==1)
		// else if(dp[i-3][2]==1 || dp[i-3][3]==1)
		{
			dp[i][3] = 1;
			st.insert(f(s.substr(i-2,3)));
		}
	}

	cout<<size(st)<<endl;
	for(auto it:st) cout<<it<<endl;

 	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    string str;
    cin >> str;

    int d[100007][4];
    int n = str.size();
    d[n - 2][2] = d[n - 3][3] = 1;
    vector <string> ans;
    for( int i = n - 4; i > 4; i-- )
    {
        for( int j = 2; j <= 3; j++ )
        {
            for( int h = 2; h <= 3; h++ )
            {
                if( i + j + h > n ||  !d[i + j][h] || str.substr(i, j) == str.substr(i + j, h))
                {
                    continue;
                }
                d[i][j] = 1;
            }
        }
    }
    for( int i = 5; i < n; i++ )
    {
        if( d[i][2] ){
            ans.push_back(str.substr(i, 2));
        }
        if( d[i][3] ){
            ans.push_back(str.substr(i, 3));
        }
    }
    sort( ans.begin(), ans.end() );
    ans.erase( unique( ans.begin(), ans.end() ), ans.end() );
    cout <<ans.size() << "\n";
    for(int i=0; i<ans.size(); i++){
        cout << ans[i] << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    string str;
    cin >> str;
    vector < map <string,bool> >dp (str.size());
    string tmp;
    tmp+=str[5];
    tmp+=str[6];
    dp[6][tmp]=true;
    for (int i=7; i<str.size(); i++){
        for (auto j=dp[i-2].begin(); j!=dp[i-2].end(); j++){
            if (j -> first.size()==3 && j -> first[0]==str[i-2] && j -> first[1]==str[i-1] && j -> first[2]==str[i]){
                continue;
            } else {
            dp[i][j -> first]=j -> second;
            }
        }
                for (auto j=dp[i-1].begin(); j!=dp[i-1].end(); j++){
            if (j -> first.size()==2 && j -> first[0]==str[i-1] && j -> first[1]==str[i]){
                continue;
            } else {
            dp[i][j -> first]=j -> second;
        }
        }
        string tmp1,tmp2;
        tmp1+=str[i-2];
        tmp1+=str[i-1];
        tmp1+=str[i];
        tmp2+=str[i-1];
        tmp2+=str[i];
        dp[i][tmp1]=true;
        dp[i][tmp2]=true;
    }
    cout << dp[str.size()-2].size();
    for (auto i=dp[str.size()-2].begin(); dp[str.size()-2].end()!=i; i++){
        cout << i-> first << endl;
    }
    return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <cmath>
#include <random>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <functional>

#include <vector>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <map>
#include <deque>
#include <array>
#include <iterator>
#include <bitset>
#include <initializer_list>

//#include <ext/rope>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_cxx;
//using namespace __gnu_pbds;

//template<class T, class C = null_type> using Tree = tree<T, C, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>;

namespace io{

    template<typename A, typename B> ostream& operator << ( ostream &os, pair<A, B> &p ) { return os << p.first << " " << p.second; }
    template<typename A> ostream& operator << ( ostream &os, vector<A> &v ) { for( A p : v ) cout << p << " "; return os; }
    template<typename A, typename B> ostream& operator << ( ostream &os, vector<pair<A, B>> &v ) { for( auto p : v ) cout << p << endl; return os; }
    template<typename A, typename B> ostream& operator << ( ostream &os, map<A, B> &mp ) { for( auto it : mp ) os << it.first << " " << it.second << endl; return os; }
    template<typename A> ostream& operator << ( ostream &os, set<A> &st ) { for( A p : st ) cout << p << " "; return os; }

    template<typename A, typename B> istream& operator >> ( istream &is, pair<A, B> &p ) { return is >> p.first >> p.second; }
    template<typename A> istream& operator >> ( istream &is, vector<A> &v ) { for( A &p : v ) is >> p; return is; }
    template<typename A, typename B> istream& operator >> ( istream &is, vector<pair<A, B>> &v ) { for( auto &p : v ) is >> p.first >> p.second; return is; }

    template<typename A, typename B> inline void output( pair<A, B> &p ) { cout << "{" << p.first << ", " << p.second << "}" << endl; }
    template<typename A, typename B> inline void output( map<A, B> &mp ){ cout << endl; for( auto it: mp ) cout << "{" << it.first << ", " << it.second << "}" << endl; }
    template<typename A> inline void output( vector<A> &v ){ cout << "{"; for( int i = 0; i < v.size(); i++ ){ cout << v[i]; if( i < v.size() - 1 ) cout << ", "; } cout << "}"; cout << endl; }
    template<typename A, typename B> inline void output( vector<pair<A, B>> &v ) { cout << endl; for( auto p : v ) cout << "{" << p.first << ", " << p.second << "}" << endl; }
    template<typename A> inline void output( set<A> &st ){ cout << "{"; for( A p : st ){ cout << p; if( p != *st.rbegin() ) cout << ", "; } cout << "}"; cout << endl; }

    long long read(){ char c; long long d = 1, x = 0; do c = getchar(); while( c == ' ' || c == '\n' ); if( c == '-' ) c = getchar(), d = -1; while( isdigit( c ) ){ x = x * 10 + c - '0'; c = getchar(); } return d * x;}

}

using namespace io;

#define ALL( x ) x.begin(), x.end()
#define RALL( x ) x.rbegin(), x.rend()
#define SORT( x ) sort( ALL( x ) )
#define REV( x ) reverse( ALL( x ) )
#define print( x ) cout << #x << " = " << x << endl;
#define write( x ) cout << #x << ": "; output( x );

#define forn( i, a, b ) for( int i = a; i <= b; i++ )
#define forv( i, a, b ) for( int i = a; i >= b; i-- )
#define sqr( x ) ( x ) * ( x )
#define gcd( a, b ) __gcd( a, b )
#define lcm( a, b ) ( ( a ) * ( ( b ) / gcd( a, b ) ) )

template<typename T1, typename T2> auto max ( T1 a, T2 b ) { auto max = a > b ? a : b; return max; }
template<typename T1, typename T2> auto min ( T1 a, T2 b ) { auto min = a < b ? a : b; return min; }

template<typename T1, typename T2> void updmax ( T1 &a, T2 b ) { a = a > b ? a : b; }
template<typename T1, typename T2> void updmin ( T1 &a, T2 b ) { a = a < b ? a : b; }

const int MOD = ( int ) 1e9 + 7; // 998244353
const double EPS = 1e-9;
const double PI = acos ( -1. );

const int MAXN = ( int ) 1e6 + 10;
const int N = 1001;

static int a[MAXN], b[MAXN];

int n, m, k;
string s, t;

int p[MAXN], c[MAXN], used[MAXN], mx_sum[MAXN], childs[MAXN];
vector<int> g[MAXN];

int lift( int v, int s = 0 ){
    if( v == 1 ) return 0;
    if( mx_sum[v] ) return mx_sum[v];
    int u = p[v];
    int mx = lift( u, s + c[v] );
    return max( mx + c[v], c[v] );
}

int dfs( int v, int p = -1 ){
    childs[v] = 1;
    for( int u : g[v] ){
        if( !used[u] && u != v ){
            childs[v] += dfs( u, v );
        }
    }
    return childs[v];
}

void solution()
{
    n = read();
    for( int i = 1; i <= n; i++ ){
        a[i] = read();
    }
    for( int i = 2; i <= n; i++ ){
        p[i] = read();
        c[i] = read();
        g[p[i]].push_back( i );
    }
    for( int i = 1; i <= n; i++ ){
        mx_sum[i] = lift( i );
        if( mx_sum[i] > a[i] ){
            used[i] = 1;
        }
    }
    cout << n - dfs( 1 ) << endl;
}

int32_t main ( )
{

    int T1 = clock();

    //freopen("FILE_NAME.in", "r", stdin);
    //freopen("FILE_NAME.out", "w", stdout);

    //ios_base::sync_with_stdio ( false ); cin.tie ( nullptr ); cout.tie ( nullptr );
    //cout.precision(15);

    int query = 1;
    // cin >> query;

    while ( query-- ) solution();

    int T2 = clock();

    cerr << "Time: " << ( T2 - T1 ) / 1000. << " s." << endl;

    return 0;

}


#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <cmath>
#include <random>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <functional>

#include <vector>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <map>
#include <deque>
#include <array>
#include <iterator>
#include <bitset>
#include <initializer_list>

//#include <ext/rope>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_cxx;
//using namespace __gnu_pbds;

//template<class T, class C = null_type> using Tree = tree<T, C, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>;

namespace io{

    template<typename A, typename B> ostream& operator << ( ostream &os, pair<A, B> &p ) { return os << p.first << " " << p.second; }
    template<typename A> ostream& operator << ( ostream &os, vector<A> &v ) { for( A p : v ) cout << p << " "; return os; }
    template<typename A, typename B> ostream& operator << ( ostream &os, vector<pair<A, B>> &v ) { for( auto p : v ) cout << p << endl; return os; }
    template<typename A, typename B> ostream& operator << ( ostream &os, map<A, B> &mp ) { for( auto it : mp ) os << it.first << " " << it.second << endl; return os; }
    template<typename A> ostream& operator << ( ostream &os, set<A> &st ) { for( A p : st ) cout << p << " "; return os; }

    template<typename A, typename B> istream& operator >> ( istream &is, pair<A, B> &p ) { return is >> p.first >> p.second; }
    template<typename A> istream& operator >> ( istream &is, vector<A> &v ) { for( A &p : v ) is >> p; return is; }
    template<typename A, typename B> istream& operator >> ( istream &is, vector<pair<A, B>> &v ) { for( auto &p : v ) is >> p.first >> p.second; return is; }

    template<typename A, typename B> inline void output( pair<A, B> &p ) { cout << "{" << p.first << ", " << p.second << "}" << endl; }
    template<typename A, typename B> inline void output( map<A, B> &mp ){ cout << endl; for( auto it: mp ) cout << "{" << it.first << ", " << it.second << "}" << endl; }
    template<typename A> inline void output( vector<A> &v ){ cout << "{"; for( int i = 0; i < v.size(); i++ ){ cout << v[i]; if( i < v.size() - 1 ) cout << ", "; } cout << "}"; cout << endl; }
    template<typename A, typename B> inline void output( vector<pair<A, B>> &v ) { cout << endl; for( auto p : v ) cout << "{" << p.first << ", " << p.second << "}" << endl; }
    template<typename A> inline void output( set<A> &st ){ cout << "{"; for( A p : st ){ cout << p; if( p != *st.rbegin() ) cout << ", "; } cout << "}"; cout << endl; }

    long long read(){ char c; long long d = 1, x = 0; do c = getchar(); while( c == ' ' || c == '\n' ); if( c == '-' ) c = getchar(), d = -1; while( isdigit( c ) ){ x = x * 10 + c - '0'; c = getchar(); } return d * x;}

}

using namespace io;

#define int long long
#define add push_back

#define ALL( x ) x.begin(), x.end()
#define RALL( x ) x.rbegin(), x.rend()
#define SORT( x ) sort( ALL( x ) )
#define REV( x ) reverse( ALL( x ) )
#define print( x ) cout << #x << " = " << x << endl;
#define write( x ) cout << #x << ": "; output( x );

#define forn( i, a, b ) for( int i = a; i <= b; i++ )
#define forv( i, a, b ) for( int i = a; i >= b; i-- )
#define sqr( x ) ( x ) * ( x )
#define gcd( a, b ) __gcd( a, b )
#define lcm( a, b ) ( ( a ) * ( ( b ) / gcd( a, b ) ) )

template<typename T1, typename T2> auto max ( T1 a, T2 b ) { auto max = a > b ? a : b; return max; }
template<typename T1, typename T2> auto min ( T1 a, T2 b ) { auto min = a < b ? a : b; return min; }

template<typename T1, typename T2> void updmax ( T1 &a, T2 b ) { a = a > b ? a : b; }
template<typename T1, typename T2> void updmin ( T1 &a, T2 b ) { a = a < b ? a : b; }

int operator"" _E ( unsigned int n ){
    int p = 1, a = 10;
    while( n ){
        if( n & 1 ){
            p *= a;
        }
        a *= a;
        n >>= 1;
    }
    return p;
}

long double operator "" _deg ( long double deg ){
    long double PI = acos( -1 );
    return deg * PI / 180;
}

const int MOD = ( int ) 1e9 + 7; // 998244353
const double EPS = 1e-9;
const double PI = acos ( -1. );
long long llinf = 4 * 18_E;
int inf = 2 * 9_E;

const int MAXN = ( int ) 1e6 + 10;
const int N = 1001;

static int a[MAXN], b[MAXN];
static int c[N][N];

int n, m, k;
string s, t;

int dp[MAXN][4];

void solution()
{
    cin >> s;
    int n = s.size();
    s = " " + s;
    if( n <= 6 ){
        cout << 0 << endl;
        return;
    }

    set<string> st;
    st.insert( s.substr( n - 1, 2 ) );
    if( n >= 8 ){
        st.insert( s.substr( n - 2, 3 ) );
    }

    dp[n - 1][2] = 1;
    dp[n - 2][3] = 1;

    for( int i = n - 3; i >= 6; i-- ){
        string suf_1 = s.substr( i, 2 );
        string suf_2 = s.substr( i, 3 );
        if( dp[i + 2][3] || ( s.substr( i + 2, 2 ) != suf_1 && dp[i + 2][2] ) ){
            dp[i][2] = 1;
            st.insert( suf_1 );
        }
        if( dp[i + 3][2] || ( s.substr( i + 3, 3 ) != suf_2 && dp[i + 3][3] ) ){
            dp[i][3] = 1;
            st.insert( suf_2 );
        }
    }

    cout << st.size() << endl;
    for( string s : st ){
        cout << s << endl;
    }
}

int32_t main ( )
{

    int T1 = clock();

    //freopen("FILE_NAME.in", "r", stdin);
    //freopen("FILE_NAME.out", "w", stdout);

    ios_base::sync_with_stdio ( false ); cin.tie ( nullptr ); cout.tie ( nullptr );
    //cout.precision(15);

    int query = 1;
    // cin >> query;

    while ( query-- ) solution();

    int T2 = clock();

    cerr << "Time: " << ( T2 - T1 ) / 1000. << " s." << endl;

    return 0;

}


#include<bits/stdc++.h>
#define ll   long long int
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define inf 100000000000000LL
#define fast_io	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mod 998244353
#define range 50005
#define lg 22
#define range2 1000000000
#define pp pair<pair<ll,ll>,ll>
#define endl "\n"
using namespace std;

string s;
set<string> ans;
ll calc(ll pos,ll d)
{
	if(pos<=3)
	return 0;
	string s0,s1,s2,s3;
	s0=s.substr(pos-1,2);
	s1=s.substr(pos-2,3);
	s2=s.substr(pos+1,2);
	s3=s.substr(pos+1,3);
	ll x=0,x1=0,x2=0;
	if(d==2)
	{
		x1=calc(pos-3,3);
		if(x1!=0)
		ans.insert(s1);
		if(s0!=s2)
		{
			x2=calc(pos-2,2);
			if(x2!=0)
			ans.insert(s0);
		}

	}
	else if(d==3)
	{
		x1=calc(pos-2,2);
		if(x1!=0)
		ans.insert(s0);
		if(s1!=s3)
		{
			x2=calc(pos-3,3);
			if(x2!=0)
			ans.insert(s1);
		}

	}
	x=x1+x2+1;

	return x;
}
int main()
{

	cin>>s;
	ll n=s.length();
	s=s+"   ";
	calc(n-1,2)+calc(n-1,3);
	cout<<ans.size()<<endl;
	for(auto i:ans)
	cout<<i<<" ";
}


#include<bits/stdc++.h>
#define ll   long long int
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define inf 100000000000000LL
#define fast_io	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mod 998244353
#define range 10005
#define lg 22
#define range2 1000000000
#define pp pair<pair<ll,ll>,ll>
#define endl "\n"
using namespace std;
ll dp[range][4];
string s;
set<string> ans;
ll calc(ll pos,ll d)
{
	if(pos<=3)
	return 0;
	if(dp[pos][d]!=-1)
	return dp[pos][d];
	string s0,s1,s2,s3;
	s0=s.substr(pos-1,2);
	s1=s.substr(pos-2,3);
	s2=s.substr(pos+1,2);
	s3=s.substr(pos+1,3);
	ll x=0,x1=0,x2=0;
	if(d==2)
	{
		x1=calc(pos-3,3);
		if(x1!=0)
		ans.insert(s1);
		if(s0!=s2)
		{
			x2=calc(pos-2,2);
			if(x2!=0)
			ans.insert(s0);
		}

	}
	else if(d==3)
	{
		x1=calc(pos-2,2);
		if(x1!=0)
		ans.insert(s0);
		if(s1!=s3)
		{
			x2=calc(pos-3,3);
			if(x2!=0)
			ans.insert(s1);
		}

	}
	x=x1+x2+1;

	return dp[pos][d]=x;
}
int main()
{
	memset(dp,-1,sizeof(dp));
	cin>>s;
	ll n=s.length();
	s=s+"   ";
	calc(n-1,2)+calc(n-1,3);
	cout<<ans.size()<<endl;
	for(auto i:ans)
	cout<<i<<" ";
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

const int INF = 1e9;
const int N = 1e4 + 1;

int n;
string s;
set<string> ans;
bool good[N][2];
bool dp[N][2];

void solve() {
  for (int i = 0; i < n; i++) {
    good[i][0] = good[i][1] = 1;
    if (i - 3 >= 0 and s.substr(i - 3, 2) == s.substr(i - 1, 2)) {
      good[i][0] = 0;
    }

    if (i - 5 >= 0 and s.substr(i - 5, 3) == s.substr(i - 2, 3)) {
      good[i][1] = 0;
    }
  }

  dp[1][0] = 1; // Suffix of length 2
  dp[2][1] = 1; // Suffix of length 3

  for (int i = 0; i < n - 4; i++) {
    for (int j = 0; j < 2; j++) {
      if (j == 0 and i - 2 >= 0) {
        bool len2 = good[i][0] ? dp[i - 2][0] : 0;
        bool len3 = dp[i - 2][1];
        dp[i][j] = len2 or len3;
      }

      if (j == 1 and i - 3 >= 0) {
        bool len2 = dp[i - 3][0];
        bool len3 = good[i][1] ? dp[i - 3][1] : 0;
        dp[i][j] = len2 or len3;
      }
    }
  }

  for (int i = 0; i < n - 5; i++) {
    if (dp[i][0]) {
      string suffix = s.substr(i - 1, 2);
      reverse(all(suffix));
      ans.insert(suffix);
    }
    if (dp[i][1]) {
      string suffix = s.substr(i - 2, 3);
      reverse(all(suffix));
      ans.insert(suffix);
    }
  }
}

int main() {
  cin >> s;
  n = sz(s);
  reverse(all(s));
  solve();
  cout << sz(ans) << endl;
  for (string a : ans) {
    cout << a << endl;
  }
}


#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define ff              first
#define ss              second
#define pb(x)           push_back(x)
#define mp              make_pair
#define sz(x)           (int)x.size()
#define mem(x ,y)       memset(x , y , sizeof x )
#define all(a )         a.begin() , a.end()
#define endl            "\n"
#define pii             pair<int,int>
#define clr(x)          x.clear()
#define sl(x )          scanf("%I64d" ,&x)
#define sll(x,y )       scanf("%I64d%I64d" ,&x ,&y)
#define si(x )          scanf("%d" ,&x)
#define forn(i,x,y )    for(int i= x; i<=y ; i++ )
#define ford(i,x,y )    for(int i= x; i>=y ; i-- )
#define rep(i,n )       for(int i= 0; i<n ; i++ )
#define repi(i,n )      for(int i= 1; i<=n ; i++ )
#define repit(i, c)     for( __typeof((c).begin()) i = (c).begin(); i != (c).end();++i )

#ifndef ONLINE_JUDGE
    #define dbg(args...)    do {   cout << #args << ' ' ;  print(args); } while(0); cerr<< endl ;
#else
    #define dbg(args...)   ;
#endif

typedef long long ll  ;
typedef unsigned long long ull  ;

ll  mod =  1e9+7, mod2 = 998244353 ;
int setbit(int n, int pos  ) { return n = n|(1LL<< pos) ; }
int resetbit(int n,int pos ) {  return n =  n & ~(1LL<<pos ); }
bool checkbit(int  n,int pos ) { return (bool ) (n&(1LL<<pos))  ; }
template<typename T> void print(const T& v) {    cerr << v << ' ' ;}
template<typename T>T add(T x, T y, T mod = mod ){ x%= mod ;  y%= mod ;   return (x+y)%mod ;  }
template<typename T>T sub(T x, T y, T mod = mod ){ return ((x-y)%mod+mod )%mod;  }
template<typename T>T mul(T x, T y, T mod = mod ){ x %= mod ; y %= mod ; return (x*y)%mod  ;  }
template<typename T1,typename... T2> void print( const T1& first, const T2&... rest ){ print(first); print(rest...) ;}
template<typename T> void dbg_a(T a[] ,int n=10 ) {cerr << "[ "; for(int i=0;i <= n ; i++ )cerr<<a[i]<<' ' ; cerr<< " ]" <<  endl; }
template<typename F,typename S>ostream& operator<<( ostream& os, const pair< F, S > & p ){return os << "[ " << p.first << ", " << p.second << " ]";}
template<typename T>ostream &operator<<(ostream & os, const vector< T > &v ){os << "[ "; for(int i=0; i<sz(v) ; i++ )  os << v[i] << ' ' ; return os << " ]\n" ; }
template<typename T>ostream &operator<<(ostream & os, const map< T ,T> &Map ){os << "[ "; repit(it , Map ) os << "[" <<(*it).ff << ' ' << (*it).ss << "] "    ; return os << "]\n" ; }
template<typename T>ostream &operator<<(ostream & os, const set< T > &Set  ){os << "[ "; repit(it , Set ) os <<  *it  << ' ' ; return os << " ]\n" ; }
template<typename T>ostream &operator<<(ostream & os, const multiset< T > &Set) {os << "[ "; repit(it , Set )os <<  *it  << ' ' ; return os << " ]\n" ; }
template<class T> string to_str(T t){stringstream ss; ss<<t; return ss.str();}
// typedef tree<   int ,     // change type
//               null_type,
//               less_equal  < int  >  ,  // change type ..
//               rb_tree_tag,
//               tree_order_statistics_node_update> ordered_set;

    // order_of_key (k) : Number of items strictly smaller than k .
    // find_by_order(k) : K-th element in a set (counting from zero).

template < typename T >
T  bigmod(T x, T k ,T mod = mod) {
    if(k == 0 ) return (T)1;
    if(k&1  ) {
        return ( (x%mod)*bigmod(x,k-1, mod )%mod )%mod ;
    } else {
        T ret = bigmod(x,k/2  , mod ) ;
        ret %= mod ;
        return (ret*ret )%mod;
    }
}
template < typename T >
T  invmod( T x , T m) {
    return bigmod(x,m-2 , m) ;

}
#define  int  ll
const int maxn  = (int)1e4 +123 ;
const ll inf  =  1e16 ; //  0xc0  ; //0x3f ; //
/////////////////////////////////////////////////////

int  n , m   ;
int  dp[maxn][4 ]      ;
 set< string > st  ;
string s   ;
string get(int id ,int len)  {
    string str =  "" ;
    rep(i,len  )  {
        str += s[id-i] ;

    }
    return str ;
}

void  solve() {
    int   x ,y,ans  = 0 ,k ,q,t ,tot ,d  ;

    cin >> s  ;
    reverse(all(s)) ;
    s = '-' + s ;

    n = sz(s  )-1 ;
    dp[0][2]  = dp[0][3] = 1 ;

    string str ,s1, s2   ;
    forn(i,1,n )  {
        if(i+5>n ) break;
        if(i-3<0) ;
        else if( i-3==0)  {
            dp[i][3] = 1 ;
            str = get(i,3)  ;
            st.insert(str) ;
        } else {

            if(dp[i-3][2]==1) {
                dp[i][3] = 1 ;
            }  else if( dp[i-3][3]==1) {
                s1= get(i,3) ;
                s2= get(i-3,3 ) ;
                if(s1!=s2) {
                    dp[i][3] = 1 ;
                }

            }
            if(dp[i][3]==1) {
                str = get(i,3 ) ;
                st.insert(str) ;
            }

        }

        if(i-2<0) ;
        else if( i-2==0)  {
            dp[i][2] = 1 ;
            str = get(i,2);
            st.insert(str) ;
        } else {

            if(dp[i-2][3]==1) {
                dp[i][2] = 1 ;
            }  else if( dp[i-2][2]==1) {
                s1= get(i,2 ) ;
                s2= get(i-2,2 ) ;
                if(s1!=s2) {
                    dp[i][2] = 1 ;
                }

            }
            if(dp[i][2]==1) {
                str = get(i,2 );
                st.insert(str) ;
            }

        }

    }

    cout  << sz(st) << endl  ;
    repit( it ,st ) {
        cout << *it << endl ;

    }

}
signed main() {
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
           //freopen("out.txt", "w", stdout) ;
    #endif
    ios :: sync_with_stdio(false);  cin.tie(0);  cout.tie(0) ;
    // clock_t st = clock()  ;
    // cout << fixed << setprecision(12) ;
    int  c = 0 ,t = 1  ;
    // cin  >>t ;
    while(t--) {
        solve() ;
    }
    //cerr<<"Execution time : " << (double)(clock()-st )/CLOCKS_PER_SEC << endl ;

    return 0 ;
}


#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mat vector<vector<int>>
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<n;i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll

auto max(auto a){auto ans=a[0];for(auto i:a)if(i>ans)ans=i;return ans;}
auto min(auto a){auto ans=a[0];for(auto i:a)if(i<ans)ans=i;return ans;}
void print(auto a){for(auto i:a)cerr<<i<<' ';cerr<<'\n';}

signed main()
{

	string s;
	cin>>s;
	int n=s.size();
	bool dp[n][2];
	memset(dp,0,sizeof(dp));

	if(n==5)
	{
		cout<<0;
		return 0;
	}
	if(n==6)
	{
		cout<<1<<'\n';
		cout<<s.substr(n-2,2);
		return 0;
	}

	dp[n-2][0]=dp[n-3][1]=1;
	set<string> ans;
	ans.insert(s.substr(n-2,2));
	ans.insert(s.substr(n-3,3));
	for(int i=n-4;i>=5;i--)
	{
		//cout<<i<<dp[i+3][1]<<','<<s.substr(i,3)<<'v'<<s.substr(i+3,3)<<'.'<<dp[i+2][0]<<endl;
		if((dp[i+2][0]==1 && s.substr(i,2)!=s.substr(i+2,2)) || dp[i+2][1]==1)
		{
			ans.insert(s.substr(i,2));
			dp[i][0]=1;
		}
		if((dp[i+3][1]==1 && s.substr(i,3)!=s.substr(i+3,3)) || dp[i+3][0]==1)
		{
			ans.insert(s.substr(i,3));
			dp[i][1]=1;
		}
	}
	cout<<ans.size()<<'\n';
	for(auto i:ans)
		cout<<i<<'\n';
	printclock;
}


#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mat vector<vector<int>>
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<n;i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll

auto max(auto a){auto ans=a[0];for(auto i:a)if(i>ans)ans=i;return ans;}
auto min(auto a){auto ans=a[0];for(auto i:a)if(i<ans)ans=i;return ans;}
void print(auto a){for(auto i:a)cerr<<i<<' ';cerr<<'\n';}

signed main()
{

	string s;
	cin>>s;
	int n=s.size();
	bool dp[n][2];
	memset(dp,0,sizeof(dp));

	if(n==5 || n==6)
	{
		cout<<0;
		return 0;
	}
	if(n==7)
	{
		cout<<1<<'\n';
		cout<<s.substr(n-2,2);
		return 0;
	}

	dp[n-2][0]=dp[n-3][1]=1;
	set<string> ans;
	ans.insert(s.substr(n-2,2));
	ans.insert(s.substr(n-3,3));
	for(int i=n-4;i>=5;i--)
	{
		//cout<<i<<dp[i+3][1]<<','<<s.substr(i,3)<<'v'<<s.substr(i+3,3)<<'.'<<dp[i+2][0]<<endl;
		if((dp[i+2][0]==1 && s.substr(i,2)!=s.substr(i+2,2)) || dp[i+2][1]==1)
		{
			ans.insert(s.substr(i,2));
			dp[i][0]=1;
		}
		if((dp[i+3][1]==1 && s.substr(i,3)!=s.substr(i+3,3)) || dp[i+3][0]==1)
		{
			ans.insert(s.substr(i,3));
			dp[i][1]=1;
		}
	}
	cout<<ans.size()<<'\n';
	for(auto i:ans)
		cout<<i<<'\n';
	printclock;
}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#define maxpq priority_queue<ll>
#define minpq priority_queue<ll, vector<ll>, greater<ll> >
#define vi vector<ll>
#define pii pair<ll, ll>
#define vii vector<pii>
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define MOD 1000000007
#define INT_MAXI 9000000000000000000
#define INT_MINI -9000000000000000000

ll max(ll a, ll b) {if (a > b) return a; else return b;}
ll min(ll a, ll b) {if (a < b) return a; else return b;}

const int dx[4] = { -1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };

string str;
ll n;
set<string>s;

ll dp[10004];

ll func(ll ind)
{
	if(dp[ind]!=-1)
	return dp[ind];

	ll cnt=0;

	if(ind-2>=4)
	{
		string str2;
	    str2.pb(str[ind-1]);
	    str2.pb(str[ind]);
	    s.insert(str2);
	    cnt+=func(ind-2);
	}
	if(ind-3>=4)
	{
		string str2;
		str2.pb(str[ind-2]);
		 str2.pb(str[ind-1]);
	    str2.pb(str[ind]);
		s.insert(str2);
		cnt+=func(ind-3);
	}

	return dp[ind]=cnt;

}

int main()
{
    memset(dp,-1,sizeof(dp));

	fio;

    ll i,j;

    cin>>str;

    n=str.length();

    ll ans=func(n-1);

    cout<<s.size()<<endl;

    for(auto itr:s)
    cout<<itr<<endl;

}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#define maxpq priority_queue<ll>
#define minpq priority_queue<ll, vector<ll>, greater<ll> >
#define vi vector<ll>
#define pii pair<ll, ll>
#define vii vector<pii>
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define MOD 1000000007
#define INT_MAXI 9000000000000000000
#define INT_MINI -9000000000000000000

ll max(ll a, ll b) {if (a > b) return a; else return b;}
ll min(ll a, ll b) {if (a < b) return a; else return b;}

const int dx[4] = { -1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };

string str;
ll n;
set<string>s;

ll dp[10004][5];

ll func(ll ind,ll flag)
{
	if(dp[ind][flag]!=-1)
	return dp[ind][flag];

	ll cnt=0,flag2=0,flag3=0;

	if(ind-2>=4)
	{
	    if(flag==1)
	{
	    string str3,str4;
	    if(str.substr(ind-1,2)==str.substr(ind+1,2))
	    {
	        flag2=1;
	    }
	}
	if(flag2==0)
	{

		string str2;
	    str2.pb(str[ind-1]);
	    str2.pb(str[ind]);
	    s.insert(str2);
	    cnt+=1+func(ind-2,1);
	}
	}
	if(ind-3>=4)
	{
	    if(flag==2)
	    {
	        if(str.substr(ind-2,3)==str.substr(ind+1,3))
	        flag3=1;
	    }
	    if(flag3==0)
	    {

		string str2;
		str2.pb(str[ind-2]);
		 str2.pb(str[ind-1]);
	    str2.pb(str[ind]);
		s.insert(str2);
		cnt+=1+func(ind-3,2);
	    }
	}

	return dp[ind][flag]=cnt;

}

int main()
{
    memset(dp,-1,sizeof(dp));

	fio;

    ll i,j;

    cin>>str;

    n=str.length();

    ll ans=func(n-1,0);

    cout<<s.size()<<endl;

    for(auto itr:s)
    cout<<itr<<endl;

}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#define maxpq priority_queue<ll>
#define minpq priority_queue<ll, vector<ll>, greater<ll> >
#define vi vector<ll>
#define pii pair<ll, ll>
#define vii vector<pii>
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define MOD 1000000007
#define INT_MAXI 9000000000000000000
#define INT_MINI -9000000000000000000

ll max(ll a, ll b) {if (a > b) return a; else return b;}
ll min(ll a, ll b) {if (a < b) return a; else return b;}

const int dx[4] = { -1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };

string str;
ll n;
set<string>s;

ll dp[10004];

ll func(ll ind,ll flag)
{
	if(dp[ind]!=-1)
	return dp[ind];

	ll cnt=0,flag2=0,flag3=0;

	if(ind-2>=4)
	{
	    if(flag==1)
	{
	    string str3,str4;
	    if(str.substr(ind-1,2)==str.substr(ind+1,2))
	    {
	        flag2=1;
	    }
	}
	if(flag2==0)
	{

		string str2;
	    str2.pb(str[ind-1]);
	    str2.pb(str[ind]);
	    s.insert(str2);
	    cnt=1+func(ind-2,1);
	}
	}
	if(ind-3>=4)
	{
	    if(flag==2)
	    {
	        if(str.substr(ind-2,3)==str.substr(ind+1,3))
	        flag3=1;
	    }
	    if(flag3==0)
	    {

		string str2;
		str2.pb(str[ind-2]);
		 str2.pb(str[ind-1]);
	    str2.pb(str[ind]);
		s.insert(str2);
		cnt=1+func(ind-3,2);
	    }
	}

	return dp[ind]=cnt;

}

int main()
{
    memset(dp,-1,sizeof(dp));

	fio;

    ll i,j;

    cin>>str;

    n=str.length();

    ll ans=func(n-1,0);

    cout<<s.size()<<endl;

    for(auto itr:s)
    cout<<itr<<endl;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    vector<set<string>> dp(n);
    for (int i = 5; i < n; i++)
    {
        string a;
        a += s[i - 1];
        a += s[i];
        string b;
        b += s[i - 3];
        b += s[i - 2];
        string c;
        c += s[i - 2];
        c += s[i - 1];
        c += s[i];
        string d;
        d += s[i - 5];
        d += s[i - 4];
        d += s[i - 3];
        if (i - 2 >= 4)
        {
            dp[i].insert(a);
            for (auto& j : dp[i - 2])
            {
                dp[i].insert(j);
            }
        }
        if (i - 3 >= 4)
        {
            dp[i].insert(c);
            for (auto& j : dp[i - 3])
            {
                dp[i].insert(j);
            }
        }
    }
    cout << dp.back().size() << "\n";
    for (auto& i : dp.back())
    {
        cout << i << "\n";
    }
    return 0;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int n = s.size();

    vector<vector<string>> uniq(n);
    vector<vector<int>> copyStr(n);
    for (int i = 6; i < n; i++)
    {
        string a;
        a += s[i - 1];
        a += s[i];
        string b;
        b += s[i - 3];
        b += s[i - 2];
        string c;
        c += s[i - 2];
        c += s[i - 1];
        c += s[i];
        string d;
        d += s[i - 5];
        d += s[i - 4];
        d += s[i - 3];
        string e;
        e += s[i - 4];
        e += s[i - 3];
        e += s[i - 2];
        string f;
        f += s[i - 4];
        f += s[i - 3];
        uniq[i].push_back(a);
        if (i >= 7)
        {
            uniq[i].push_back(c);
        }
        if (i >= 9)
        {
            uniq[i].push_back(e);
            uniq[i].push_back(f);
        }
        if (a != b)
        {
            copyStr[i].push_back(i - 2);
        }
        if (c != d)
        {
            copyStr[i].push_back(i - 3);
        }
        copyStr[i].push_back(i - 5);
    }
    set<string> answer;
    vector<bool> used(n, false);
    queue<int> q;
    q.push(n - 1);
    while (!q.empty())
    {
        int k = q.front();
        q.pop();
        for (auto& i : uniq[k])
        {
            answer.insert(i);
        }
        for (auto& i : copyStr[k])
        {
            used[i] = true;
            q.push(i);
        }
    }
    cout << answer.size() << "\n";
    for (auto& i : answer)
    {
        cout << i << "\n";
    }
    return 0;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int n = s.size();

    vector<vector<string>> uniq(n);
    vector<vector<int>> copyStr(n);
    for (int i = 6; i < n; i++)
    {
        string a;
        a += s[i - 1];
        a += s[i];
        string b;
        b += s[i - 3];
        b += s[i - 2];
        string c;
        c += s[i - 2];
        c += s[i - 1];
        c += s[i];
        string d;
        d += s[i - 5];
        d += s[i - 4];
        d += s[i - 3];
        string e;
        e += s[i - 4];
        e += s[i - 3];
        e += s[i - 2];
        string f;
        f += s[i - 4];
        f += s[i - 3];
        uniq[i].push_back(a);
        if (i >= 7)
        {
            uniq[i].push_back(c);
        }
        if (i >= 9)
        {
            uniq[i].push_back(e);
            uniq[i].push_back(f);
        }
        if (a != b)
        {
            copyStr[i].push_back(i - 2);
        }
        if (c != d)
        {
            copyStr[i].push_back(i - 3);
        }
        copyStr[i].push_back(i - 5);
    }
    set<string> answer;
    vector<bool> used(n, false);
    queue<int> q;
    q.push(n - 1);
    while (!q.empty())
    {
        int k = q.front();
        q.pop();
        for (auto& i : uniq[k])
        {
            answer.insert(i);
        }
        for (auto& i : copyStr[k])
        {
            if (!used[i])
            {
                used[i] = true;
                q.push(i);
            }
        }
    }
    cout << answer.size() << "\n";
    for (auto& i : answer)
    {
        cout << i << "\n";
    }
    return 0;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int n = s.size();

    vector<vector<string>> uniq(n);
    vector<vector<int>> copyStr(n);
    for (int i = 6; i < n; i++)
    {
        string a;
        a += s[i - 1];
        a += s[i];
        string b;
        b += s[i - 3];
        b += s[i - 2];
        string c;
        c += s[i - 2];
        c += s[i - 1];
        c += s[i];
        string d;
        d += s[i - 5];
        d += s[i - 4];
        d += s[i - 3];
        string e;
        e += s[i - 4];
        e += s[i - 3];
        e += s[i - 2];
        string f;
        f += s[i - 4];
        f += s[i - 3];
        uniq[i].push_back(a);
        if (i >= 7)
        {
            uniq[i].push_back(c);
        }
        if (i >= 9)
        {
            uniq[i].push_back(e);
            uniq[i].push_back(f);
        }
        if (a != b)
        {
            copyStr[i].push_back(i - 2);
        }
        if (c != d)
        {
            copyStr[i].push_back(i - 3);
        }
        copyStr[i].push_back(i - 5);
    }
    set<string> answer;
    vector<bool> used(n, false);
    queue<int> q;
    q.push(n - 1);
    while (!q.empty())
    {
        int k = q.front();
        cout << k << "\n";
        q.pop();
        for (auto& i : uniq[k])
        {
            answer.insert(i);
        }
        for (auto& i : copyStr[k])
        {
            if (!used[i])
            {
                used[i] = true;
                q.push(i);
            }
        }
    }
    cout << answer.size() << "\n";
    for (auto& i : answer)
    {
        cout << i << "\n";
    }
    return 0;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    vector<set<string>> dp(n);
    for (int i = 6; i < n; i++)
    {
        string a;
        a += s[i - 1];
        a += s[i];
        string b;
        b += s[i - 3];
        b += s[i - 2];
        string c;
        c += s[i - 2];
        c += s[i - 1];
        c += s[i];
        string d;
        d += s[i - 5];
        d += s[i - 4];
        d += s[i - 3];
        string e;
        e += s[i - 4];
        e += s[i - 3];
        e += s[i - 2];
        string f;
        f += s[i - 4];
        f += s[i - 3];
        dp[i].insert(a);
        if (i >= 7)
        {
            dp[i].insert(c);
        }
        if (i >= 9)
        {
            dp[i].insert(e);
            dp[i].insert(f);
        }
        if (a != b)
        {
            for (auto& j : dp[i - 2])
            {
                dp[i].insert(j);
            }
        }
        if (c != d)
        {
            for (auto& j : dp[i - 3])
            {
                dp[i].insert(j);
            }
        }
        for (auto& j : dp[i - 5])
        {
            dp[i].insert(j);
        }
    }
    cout << dp.back().size() << "\n";
    for (auto& i : dp.back())
    {
        cout << i << "\n";
    }
    return 0;

}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <cstring>
#include <string.h>
#include <sstream>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const ll MOD = 1e9+7;
const ll CFMOD = 998244353;
const double PI  = 3.14159265358;
const double EPS = 1e-8;

#define INT_MX 2147483647
#define INF ((int)1e9)
#define LLINF ((ll)1e18)
#define F first
#define S second
#define MP(x,y) make_pair(x,y)
#define sz(v) ((int)v.size())
#define rs(n) resize(n)
#define ALL(v) v.begin(),v.end()
#define reset(v) memset((v),0,sizeof(v))
#define EB emplace_back
#define PB push_back
#define PF push_front
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define vec vector
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void solve(){
    string s, tmp;
    set<string> ans;
    vector<bool> dp2, dp3;

    cin >> s;
    reverse(ALL(s));
    dp2.rs(sz(s));
    dp3.rs(sz(s));

    if(sz(s) >= 7)  dp2[0] = true;
    if(sz(s) >= 8)  dp3[0] = true;
    for(int i=3;i<sz(s);i++){
        if(i + 6 <= sz(s))
            dp2[i] = dp3[i-3] | (dp2[i-2] & (s.substr(i-2,2) != s.substr(i,2)));
        if(i + 7 <= sz(s))
            dp3[i] = dp2[i-2] | (dp3[i-3] & (s.substr(i-3,3) != s.substr(i,3)));
    }

    rep(i,sz(s)){
        if(dp2[i]){
            tmp = s.substr(i,2);
            reverse(ALL(tmp));
            ans.insert(tmp);
        }
        if(dp3[i]){
            tmp = s.substr(i,3);
            reverse(ALL(tmp));
            ans.insert(tmp);
        }
    }

    cout << sz(ans) << '\n';
    for(auto i:ans) cout << i << '\n';

}

int main(){
    int t = 1;

    while(t--){
        solve();
    }
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <cstring>
#include <string.h>
#include <sstream>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const ll MOD = 1e9+7;
const ll CFMOD = 998244353;
const double PI  = 3.14159265358;
const double EPS = 1e-8;

#define INT_MX 2147483647
#define INF ((int)1e9)
#define LLINF ((ll)1e18)
#define F first
#define S second
#define MP(x,y) make_pair(x,y)
#define sz(v) ((int)v.size())
#define rs(n) resize(n)
#define ALL(v) v.begin(),v.end()
#define reset(v) memset((v),0,sizeof(v))
#define EB emplace_back
#define PB push_back
#define PF push_front
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define vec vector
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void solve(){
    string s, tmp;
    set<string> ans;
    vector<bool> dp2, dp3;

    cin >> s;
    reverse(ALL(s));
    dp2.rs(sz(s));
    dp3.rs(sz(s));

    if(sz(s) >= 7)  dp2[0] = true;
    if(sz(s) >= 8)  dp3[0] = true;
    if(sz(s) >= 9 && s.substr(0,2) != s.substr(2,2))    dp2[2] = true;
    if(sz(s) >= 10) dp3[2] = true;
    for(int i=3;i<sz(s);i++){
        if(i + 7 <= sz(s))
            dp2[i] = dp3[i-3] | (dp2[i-2] & (s.substr(i-2,2) != s.substr(i,2)));
        if(i + 8 <= sz(s))
            dp3[i] = dp2[i-2] | (dp3[i-3] & (s.substr(i-3,3) != s.substr(i,3)));
    }

    rep(i,sz(s)){
        if(dp2[i]){
            tmp = s.substr(i,2);
            reverse(ALL(tmp));
            ans.insert(tmp);
        }
        if(dp3[i]){
            tmp = s.substr(i,3);
            reverse(ALL(tmp));
            ans.insert(tmp);
        }
    }

    cout << sz(ans) << '\n';
    for(auto i:ans) cout << i << '\n';

}

int main(){
    int t = 1;

    while(t--){
        solve();
    }
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <cstring>
#include <string.h>
#include <sstream>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const ll MOD = 1e9+7;
const ll CFMOD = 998244353;
const double PI  = 3.14159265358;
const double EPS = 1e-8;

#define INT_MX 2147483647
#define INF ((int)1e9)
#define LLINF ((ll)1e18)
#define F first
#define S second
#define MP(x,y) make_pair(x,y)
#define sz(v) ((int)v.size())
#define rs(n) resize(n)
#define ALL(v) v.begin(),v.end()
#define reset(v) memset((v),0,sizeof(v))
#define EB emplace_back
#define PB push_back
#define PF push_front
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define vec vector
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void solve(){
    string s, tmp;
    set<string> ans;
    vector<bool> dp2, dp3;

    cin >> s;
    reverse(ALL(s));
    dp2.rs(sz(s));
    dp3.rs(sz(s));

    if(sz(s) >= 7)  dp2[0] = true;
    if(sz(s) >= 8)  dp3[0] = true;
    if(sz(s) >= 9 && s.substr(0,2) != s.substr(2,2))    dp2[2] = true;
    for(int i=3;i<sz(s);i++){
        if(i + 7 <= sz(s))
            dp2[i] = dp3[i-3] | (dp2[i-2] & (s.substr(i-2,2) != s.substr(i,2)));
        if(i + 8 <= sz(s))
            dp3[i] = dp2[i-2] | (dp3[i-3] & (s.substr(i-3,3) != s.substr(i,3)));
    }

    rep(i,sz(s)){
        if(dp2[i]){
            tmp = s.substr(i,2);
            reverse(ALL(tmp));
            ans.insert(tmp);
        }
        if(dp3[i]){
            tmp = s.substr(i,3);
            reverse(ALL(tmp));
            ans.insert(tmp);
        }
    }

    cout << sz(ans) << '\n';
    for(auto i:ans) cout << i << '\n';

}

int main(){
    int t = 1;

    while(t--){
        solve();
    }
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <cstring>
#include <string.h>
#include <sstream>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const ll MOD = 1e9+7;
const ll CFMOD = 998244353;
const double PI  = 3.14159265358;
const double EPS = 1e-8;

#define INT_MX 2147483647
#define INF ((int)1e9)
#define LLINF ((ll)1e18)
#define F first
#define S second
#define MP(x,y) make_pair(x,y)
#define sz(v) ((int)v.size())
#define rs(n) resize(n)
#define ALL(v) v.begin(),v.end()
#define reset(v) memset((v),0,sizeof(v))
#define EB emplace_back
#define PB push_back
#define PF push_front
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define vec vector
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

string s;
set<string> ans, st;
vec<bool> use;

void dfs(int x){

    string tmp;

    if(x < 6)   return ;

    for(int i=1;i>=0;i--)
        tmp += s[x - i];
    if(!st.count(tmp)){
        st.insert(tmp);
        ans.insert(tmp);
        dfs(x-2);
        st.erase(tmp);
    }

    if(x < 7)   return ;

    tmp.clear();
    for(int i=2;i>=0;i--)
        tmp += s[x-i];
    if(!st.count(tmp)){
        st.insert(tmp);
        ans.insert(tmp);
        dfs(x-3);
        st.erase(tmp);
    }
}

void solve(){

    cin >> s;
    use.rs(sz(s));
    dfs(sz(s)-1);

    cout << sz(ans) << '\n';
    for(auto i:ans)
        cout << i << '\n';
}

int main(){
    IOS
    int t = 1;

    while(t--){
        solve();
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define R(i,b,a) for(int i=(int)(b);i>=(int)(a);i--)
#define endl "\n"
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define out(x) cout<<x<<endl,exit(0);
#define pii pair<int,int>
#define pb push_back
#define all(v) v.begin(),v.end()
#define I first
#define S second

const int N=1e4+9;
int dp[N][2];

int32_t main(){
    ios;
    string s;
    cin>>s;

    if(s.size()<7) out(0);
    s=s+'.';
    s=s.substr(5);
    int n=s.size();

    set <string> con;
    dp[n-1][0]=dp[n-1][1]=1;
    if(n>2) dp[n-3][0]=1,con.insert(s.substr(n-3,2));

    R(i,n-4,0){
        string a,b,c,d;

        a=s.substr(i+2,2);
        c=s.substr(i,2);
        if(i+5<n) b=s.substr(i+3,3);
        d=s.substr(i,3);

        if(dp[i+2][1] || (dp[i+2][0] && a!=c)){
            dp[i][0]=1;
            con.insert(c);
        }

        if(dp[i+3][0] || (dp[i+3][1] && b!=d)){
            dp[i][1]=1;
            con.insert(d);
        }
    }
    cout<<con.size()<<endl;
    for(auto it:con) cout<<it<<endl;

}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define R(i,b,a) for(int i=(int)(b);i>=(int)(a);i--)
#define endl "\n"
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define out(x) cout<<x<<endl,exit(0);
#define pii pair<int,int>
#define pb push_back
#define all(v) v.begin(),v.end()
#define I first
#define S second

const int N=1e4+9;
int dp[N];

int32_t main(){
    ios;
    string s;
    cin>>s;

    if(s.size()<7) out(0);
    s=s+'.';
    s=s.substr(5);
    int n=s.size();

    set <string> con;
    dp[n-1]=1;
    if(n>2) dp[n-3]=1,con.insert(s.substr(n-3,2));

    R(i,n-4,0){
        string a,b,c,d;

        if(dp[i+2]){
            a=s.substr(i+2,2);
            c=s.substr(i,2);
            if(a!=c){
                dp[i]=1;
                con.insert(c);
            }
        }
        if(dp[i+3]){
            if(i+5<n) b=s.substr(i+3,3);
            d=s.substr(i,3);

            if(b!=d){
                dp[i]=1;
                con.insert(d);
            }
        }
    }
    cout<<con.size()<<endl;
    for(auto it:con) cout<<it<<endl;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005;
const ll INF=1LL<<60;
bool ok[MAX][5];

int main(){

    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S;cin>>S;
    int N=si(S);
    set<string> SE;

    ok[0][2]=ok[0][3]=1;

    reverse(all(S));

    for(int i=2;i<N;i++){
        for(int j=2;j<=3;j++){
            if(i-j<0) continue;
            string A=S.substr(i-j,j);

            for(int k=2;k<=3;k++){
                if(ok[i-j][k]){
                    if(i-j==0) ok[i][j]=1;
                    else{
                        string B=S.substr(i-j-k,k);
                        if(A!=B) ok[i][j]=1;
                    }
                }
            }
        }
    }

    reverse(all(S));

    for(int i=5;i<N;i++){
        for(int j=2;j<=3;j++){
            int rem=N-i-j;
            if(rem<0||rem==1) continue;
            if(ok[rem][2]||ok[rem][3]) SE.insert(S.substr(i,j));
        }
    }

    cout<<si(SE)<<endl;
    for(auto x:SE) cout<<x<<"\n";

}


#include <bits/stdc++.h>

#define  ll  long long
#define  pii pair<int,int>
#define  pll pair<ll , ll>
#define  debug cout << "this far" << endl;
#define  For(i, n) for(int i = 0; i < (n); ++i)
#define  lsb(x) ((x) & (-x))
#define  PI acos(-1)
#define  line cout << endl;
#define  getbit(n, i) (((n) & (1LL << (i))) != 0)
#define  resetbit(n, i) ((n) & (~(1LL << (i))))
#define  setbit(n, i) ((n) | (1LL << (i)))
#define  togglebit(n, i) ((n) ^ (1LL << (i)))
#define  gap " "
using namespace std;
const int N = 2e5 + 10;
int dp[4][N];
string str2[N], str3[N];
set<string> ans;
int n;

int cal(int len, int idx) {
    //cout << len << gap << idx  << endl ;
    //cout << str2[idx] << gap << str3[idx] << endl;
    if (dp[len][idx] != -1) return dp[len][idx];
    if(idx == n  - 1 ) return  dp[len][idx] = 1 ; ;
    int x = 0;
    if (idx + 2 < n) {
        if (len == 2 && str2[idx] == str2[idx + 2]) {}
        else
            x |= cal(2, idx + 2);
    }
    if (idx + 3 < n) {
        if (len == 3 && str3[idx] == str3[idx + 3]) {}
        else x |= cal(3, idx + 3);
    }
    x = x ? 1 : 0;
    return dp[len][idx] = x;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string s;
    cin >> s;
     n = s.length();
    for (int i = 0; i < n - 1; ++i) {
        str2[i + 1] = s.substr(i, 2);
        if (i + 2 < n)
            str3[i + 2] = s.substr(i, 3);
    }
    for (int i = 0; i < 4; ++i) {
        for (int j = 0; j <= n; ++j) dp[i][j] = -1;
    }
    for(int i = 6 ; i < n ; ++i )  {
        if(dp[2][i] == -1) cal(2 , i) ;
        if( i > 6 && dp[3][i] == -1 ) cal(3 , i );
    }
    for(int i = 5 ; i < n;  ++i)  {
        if(dp[2][i] > 0 ) ans.insert(str2[i]) ;
        if(dp[3][i] > 0 ) ans.insert(str3[i]) ;
    }
    cout << ans.size() << endl;
    for(auto  I : ans) cout << I << endl ;

}


#include <bits/stdc++.h>

#define  ll  long long
#define  pii pair<int,int>
#define  pll pair<ll , ll>
#define  debug cout << "this far" << endl;
#define  For(i, n) for(int i = 0; i < (n); ++i)
#define  lsb(x) ((x) & (-x))
#define  PI acos(-1)
#define  line cout << endl;
#define  getbit(n, i) (((n) & (1LL << (i))) != 0)
#define  resetbit(n, i) ((n) & (~(1LL << (i))))
#define  setbit(n, i) ((n) | (1LL << (i)))
#define  togglebit(n, i) ((n) ^ (1LL << (i)))
#define  gap " "
using namespace std;
const int N = 2e5 + 10;

ll compute_hash(string const &s) {
    const int p = 31;
    const int m = 1e9 + 9;
    ll hash_value = 0;
    ll p_pow = 1;
    for (char c : s) {
        hash_value = (hash_value + (c - 'a' + 1) * p_pow) % m;
        p_pow = (p_pow * p) % m;
    }
    return hash_value;
}
vector<string> ans  ;
map < ll , int > mp ;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr) ;
    string s ; cin >> s ;
    int n = s.length() ;
    int i = n - 1 ;
    while (i > 5)  {
        string tmp ;
        tmp.push_back(s[i]) ;
        if(i - 1 > 4) tmp.push_back(s[i - 1]) ;
        reverse(tmp.begin() , tmp.end()) ;
        ll x = compute_hash(tmp) ;
        if(!mp.count(x))  {
            ans.push_back(tmp) ;
            mp[x]++ ;
        }
        reverse(tmp.begin() , tmp.end())  ;
        if(i - 2 > 4) tmp.push_back(s[i - 2]) ;
        reverse(tmp.begin() , tmp.end()) ;
        x = compute_hash(tmp) ;
        if(!mp.count(x)) {
            ans.push_back(tmp) ;
            mp[x]++ ;
        }
        if(i == n - 1 ) i -= 2 ;
        else --i ;
    }
    cout << ans.size() << endl ;
    sort(ans.begin()  , ans.end() ) ;
    for(auto j : ans ) cout << j << endl ;

}


#include <bits/stdc++.h>

#define  ll  long long
#define  pii pair<int,int>
#define  pll pair<ll , ll>
#define  debug cout << "this far" << endl;
#define  For(i, n) for(int i = 0; i < (n); ++i)
#define  lsb(x) ((x) & (-x))
#define  PI acos(-1)
#define  line cout << endl;
#define  getbit(n, i) (((n) & (1LL << (i))) != 0)
#define  resetbit(n, i) ((n) & (~(1LL << (i))))
#define  setbit(n, i) ((n) | (1LL << (i)))
#define  togglebit(n, i) ((n) ^ (1LL << (i)))
#define  gap " "
using namespace std;
const int N = 2e5 + 10;
map<string, int> ans;
string s;

void f(string cr, map<string, int> mp, int idx) {
    mp[cr]++;
    if (!ans.count(cr)) ans.insert(make_pair(cr, 1));
    string tmp;
    while (idx > 5) {
        --idx;
        tmp.push_back(s[idx]);
        if (tmp.size() >= 2) {
            reverse(tmp.begin(), tmp.end());
            if (!mp.count(tmp)) f(tmp, mp, idx);
            reverse(tmp.begin(), tmp.end());
            if (tmp.size() == 3) return;
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> s;
    int n = s.length();
    string tmp;
    if (n >= 7) {
        tmp = s.substr(n - 2, 2);
        map<string, int> mp;
        f(tmp, mp, n - 2);
    }
    if (n >= 8) {
        tmp = s.substr(n - 3, 3);
        map<string, int> mp;
        f(tmp, mp, n - 3);
    }
    cout << ans.size() << endl ;
    for(auto i : ans) cout <<  i.first << endl ;

}


#include <bits/stdc++.h>

#define  ll  long long
#define  pii pair<int,int>
#define  pll pair<ll , ll>
#define  debug cout << "this far" << endl;
#define  For(i, n) for(int i = 0; i < (n); ++i)
#define  lsb(x) ((x) & (-x))
#define  PI acos(-1)
#define  line cout << endl;
#define  getbit(n, i) (((n) & (1LL << (i))) != 0)
#define  resetbit(n, i) ((n) & (~(1LL << (i))))
#define  setbit(n, i) ((n) | (1LL << (i)))
#define  togglebit(n, i) ((n) ^ (1LL << (i)))
#define  gap " "
using namespace std;
const int N = 2e5 + 10;

map < string , int > mp ;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr) ;
    string s ; cin >> s ;
    int n = s.length() ;
    int i = n - 1 ;
    while (i > 5)  {
        string tmp ;
        tmp.push_back(s[i]) ;
        if(i - 1 > 4) tmp.push_back(s[i - 1]) ;
        reverse(tmp.begin() , tmp.end()) ;
        if(!mp.count(tmp))  {
            mp.insert(make_pair(tmp , 1) )  ;
        }
        reverse(tmp.begin() , tmp.end())  ;
        if(i - 2 > 4) tmp.push_back(s[i - 2]) ;
        reverse(tmp.begin() , tmp.end()) ;
        if(!mp.count(tmp)) {
            mp.insert(make_pair(tmp , 1)) ;
        }
        if(i == n - 1 ) i -= 2 ;
        else --i ;
    }
    cout << mp.size() << endl;  ;
    for(auto j : mp ) cout << j.first << endl ;

}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e4 + 10;

char s[maxn];
int n, dp[maxn];
map<string, int> mp;
string temp;

int main()
{
    //freopen("C:/Users/MACHENIKE/Desktop/data.in","r",stdin);
    scanf("%s", s + 1);
    n = strlen(s + 1);
    dp[n + 1] = 1;
    for (int ed = n; ed >= 5; ed--)
    {
        if (dp[ed + 1] == 0) continue;
        for (int st = ed - 1; st >= ed - 2; st--)
        {
            if (st <= 5) break;
            temp = "";
            for (int i = st; i <= ed; i++) temp += s[i];
            if (mp.find(temp) != mp.end())
            {
                int pos = mp[temp];
                if (pos > ed && dp[pos] == dp[ed + 1]) continue;
            }
            mp[temp] = st;
            dp[st] += dp[ed + 1];
        }
    }
    printf("%d\n", mp.size());
    for (auto it : mp) cout << it.first << '\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e5 + 10;

char s[maxn];
int n, dp[maxn][2];
string temp;
set<string> se;

int main()
{
    //freopen("C:/Users/MACHENIKE/Desktop/data.in","r",stdin);
    scanf("%s", s + 1);
    n = strlen(s + 1);
    dp[n + 1][0] = dp[n + 1][1] = 1;
    for (int ed = n; ed >= 5; ed--)
    {
        for (int st = ed - 1; st >= ed - 2; st--)
        {
            if (st <= 5) break;
            temp = "";
            int len = ed - st + 1;
            if ((dp[ed + 1][len & 1] | dp[ed + 1][!(len & 1)]) == 0) continue;
            for (int i = st; i <= ed; i++) temp += s[i];
            string t = "";
            for (int i = ed + 1; i <= ed + len; i++) t += s[i];
            if (temp == t && dp[ed + 1][!(len & 1)] == 0) continue;
            se.insert(temp);
            dp[st][len & 1] = 1;
        }
    }
    printf("%d\n", se.size());
    for (auto it : se) cout << it << '\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e5 + 10;

char s[maxn];
int n, dp[maxn];
string temp;
set<string> se;

int main()
{
    //freopen("C:/Users/MACHENIKE/Desktop/data.in","r",stdin);
    scanf("%s", s + 1);
    n = strlen(s + 1);
    dp[n + 1] = 1;
    for (int ed = n; ed >= 5; ed--)
    {
        if (dp[ed + 1] == 0) continue;
        for (int st = ed - 1; st >= ed - 2; st--)
        {
            if (st <= 5) break;
            temp = "";
            int len = ed - st + 1;
            for (int i = st; i <= ed; i++) temp += s[i];
            string t = "";
            for (int i = ed + 1; i <= ed + len; i++) t += s[i];
            if (temp == t) continue;
            se.insert(temp);
            dp[st] |= dp[ed + 1];
        }
    }
    printf("%d\n", se.size());
    for (auto it : se) cout << it << '\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e4 + 10;

char s[maxn];
int n, dp[maxn];
map<string, int> mp;
string temp;

int main()
{
    //freopen("C:/Users/MACHENIKE/Desktop/data.in","r",stdin);
    scanf("%s", s + 1);
    n = strlen(s + 1);
    dp[n + 1] = 1;
    for (int ed = n; ed >= 5; ed--)
    {
        if (dp[ed + 1] == 0) continue;
        for (int st = ed - 1; st >= ed - 2; st--)
        {
            if (st <= 5) break;
            temp = "";
            for (int i = st; i <= ed; i++) temp += s[i];
            if (mp.find(temp) != mp.end())
            {
                int pos = mp[temp];
                if (pos > ed && dp[pos] == dp[ed + 1] && dp[pos] == dp[pos + ed - st + 1]) continue;
            }
            mp[temp] = st;
            dp[st] += dp[ed + 1];
        }
    }
    printf("%d\n", mp.size());
    for (auto it : mp) cout << it.first << '\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e5 + 10;

char s[maxn];
int n, node_cnt, dp[maxn];
map<string, int> mp;
vector <int> vc[maxn];
string temp;

int fa[maxn];
inline int setfind(int x){ return x == fa[x] ? x : fa[x] = setfind(fa[x]);}
inline void setunion(int x,int y){ x = setfind(fa[x]); y = setfind(fa[y]); fa[x] = y;}
inline bool setcheck(int x,int y){ x = setfind(x); y = setfind(y); return x == y;}

int main()
{
    //freopen("C:/Users/MACHENIKE/Desktop/data.in","r",stdin);
    scanf("%s", s + 1);
    n = strlen(s + 1);
    dp[n + 1] = 1;
    for (int i = 1; i <= (int)1e5; i++) fa[i] = i;
    for (int ed = n; ed >= 5; ed--)
    {
        if (dp[ed + 1] == 0) continue;
        for (int st = ed - 1; st >= ed - 2; st--)
        {
            if (st <= 5) break;
            int len = ed - st + 1;
            temp = "";
            for (int i = st; i <= ed; i++) temp += s[i];
            if (mp.find(temp) != mp.end())
            {
                bool ok = false;
                for (auto it : vc[mp[temp]])
                {
                    if (ok) break;
                    if (setcheck((ed + 1) * 2, it * 2 + ((len & 1) ^ 1)) || setcheck((ed + 1) * 2 + 1, it * 2 + ((len & 1) ^ 1))) ok = true;
                    for (int i = it + 1; i <= it + len - 1; i++)
                    {
                        if (ok) break;
                        if (setcheck((ed + 1) * 2, i * 2) || setcheck((ed + 1) * 2 + 1, i * 2)
                            || setcheck((ed + 1) * 2, i * 2 + 1) || setcheck((ed + 1) * 2 + 1, i * 2 + 1)) ok = true;
                    }
                }
                if (!ok) continue;
            }
            else mp[temp] = ++node_cnt;
            vc[mp[temp]].push_back(st * 2 + (len & 1));
            bool f = true;
            for (auto it : vc[mp[temp]]) if (it == (ed + 1) * 2) f = false;
            if (f) setunion(st * 2 + (len & 1), (ed + 1) * 2);
            f = true;
            for (auto it : vc[mp[temp]]) if (it == (ed + 1) * 2 + 1) f = false;
            if (f) setunion(st * 2 + (len & 1), (ed + 1) * 2 + 1);
            dp[st] |= dp[ed + 1];
        }
    }
    printf("%d\n", mp.size());
    for (auto it : mp) cout << it.first << '\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e4 + 10;

char s[maxn];
int n, dp[maxn];
map<string, int> mp;
string temp;

int main()
{
    //freopen("C:/Users/MACHENIKE/Desktop/data.in","r",stdin);
    scanf("%s", s + 1);
    n = strlen(s + 1);
    dp[n + 1] = 1;
    for (int ed = n; ed >= 5; ed--)
    {
        if (dp[ed + 1] == 0) continue;
        for (int st = ed - 1; st >= ed - 2; st--)
        {
            if (st <= 5) break;
            temp = "";
            for (int i = st; i <= ed; i++) temp += s[i];
            if (mp.find(temp) != mp.end())
            {
                int pos = mp[temp];
                if (dp[pos] == dp[ed + 1]) continue;
            }
            mp[temp] = st;
            dp[st] += dp[ed + 1];
        }
    }
    printf("%d\n", mp.size());
    for (auto it : mp) cout << it.first << '\n';
    return 0;
}