Problem G: 复习-输出长度为3的子串

Problem G: 复习-输出长度为3的子串

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MiB

Description

输入一个字符串。

第 1 行输出它的长度;

第 2 行输出所有长度为3的子串,按顺序列出。

样例输入

abcdef

样例输出

6

abc bcd cde def

提示:子串是指 字符串中连续的一段

s.length() //得到字符串s的长度
s[i] //得到s的第i个字符
s.substr(i,a)//得到字符串s中,第i个字符开始,长度为a的子串

#include <bits/stdc++.h>
using namespace std;
string s;
int main(){
	cin >> s;
	cout << ____ << endl;//输出s的长度 
	for(int i = ___; ___; ___){
		//输出i开始长度为3的子串,然后输出一个空格。 
	}
	return 0;
}

Sample Input Copy

hello

Sample Output Copy

5
hel ell llo