1808: delete the search string
Time Limit: 1 Sec Memory Limit: 32 MBSubmit: 2002 Solved: 574
[Submit][Status][Web Board][Creator:Imported]
Description
Given a short string (without spaces), to give a plurality of fixed character string, remove short string contained in these strings.
Input
Only one set of input data.
Enter a short string (without spaces), and then until the end of the input character string until a number of files.
Output
Remove short string entered (case insensitive) and remove spaces output.
Sample Input
in
#include
int main ()
{
printf(" Hi ");
}
Sample Output
#clude
dark()
{
prtf("Hi");
}
HINT
NOTE: The string In, IN, iN, in deleted.
. 1 #include <stdio.h> 2 #include < String .h> . 3 . 4 int main () { . 5 char C [ 100 ]; . 6 char S [ 1000 ]; . 7 the gets (C); . 8 int LEN1 = strlen (C ), LEN2; . 9 // the c [i] is completely converted to lower case 10 for ( int I = 0 ; I <LEN1; I ++ ) { . 11 IF (c [i]> = ' A ' && c [i] <= ' the Z ' ) { 12 is C [I] = C [I] + 32 ; 13 is } 14 } 15 the while (the gets (S)) { 16 LEN2 = strlen (S); . 17 IF (LEN2> = LEN1) { 18 is // this matching process is not a it is understood . 19 for ( int I = 0 , K = 0 ; I < LEN2;) { 20 is // when matching, the same I, do not match, increment I! 21 is IF (S [K + I] == C [K] || S [K + I] == C [K] - 32 ) { 22 is K ++ ; 23 is IF (K == LEN1) { 24 I = I + k; // is satisfied in the term k, i increase k 25 k = 0 ; 26 is } 27 } the else { 28 IF (! S [I] = ' ' ) { 29 the printf ( " % C " , S [I]); 30 } 31 is I ++ ; 32 K = 0 ; 33 is } 34 is } 35 }else{ 36 for(int i=0; i<len2; i++){ 37 if(s[i]!=' '){ 38 printf("%c", s[i]); 39 } 40 } 41 } 42 printf("\n"); 43 } 44 return 0; 45 }