[Description]: I want to understand the meaning of the question based on the input and output, and I will not describe it any more.
[Analysis]: The most dislike of the string problem, alas, see the code. The processing methods are all in the code. Note that this question is always the same as the two adjacent strings. It can be easily solved by grasping this point.
For details, see the code:
// 196 K 1000 ms # include <iostream> # include <cstdio> # include <cstring> using namespace STD; char str1 [100], str2 [100]; int main () {int samenum = 0, spacenum = 0; // the same number of characters, as well as the number of spaces int I; CIN >>str1; cout <str1 <Endl; while (CIN> str2) {for (I = 0; I <strlen (str1), I <strlen (str2); I ++) if (str1 [I]! = Str2 [I]) break; if (I> samenum) spacenum ++; else spacenum = I; samenum = spacenum; for (I = 0; I <spacenum; I ++) putchar (""); cout <str2 <Endl; strcpy (str1, str2);} return 0 ;}
Poj 1750 dictionary