compressed string



Input Format:
First line contains the integer 'n' denoting the number of words in the dictionary s.t. 1 <= n <= 1,000
Second line would contain the first word.
It will be followed by 'n-1' lines each containing an integer and a trailing string. 
Note: The input is designed such that the integer will always be <= size of previous word formed
Example Input: 
4
india
3 hindu
5 muslim
6 christian


Output Format: 
Output a single string that is the last resulting word of the given dictionary
Example Output:
indhimchristian

Program:

#include<stdio.h>
#include<string.h>
int main()
{

       int n,a;
       char ch;
       char *ps;
       printf("enter nuber of words n:");
       scanf("%d",&n);
       char s[100];
       int i=0;
       fflush(stdin);
       printf("enter 1st word\n");
       scanf("%s",s);
       printf("enter integer space word\n");
       for(i=1;i<=n-1;i++)
       {
             scanf("%d",&a);
             scanf(" %s",s+a);
       }
        printf("%s",s);
        return 0;
}


Sample input and output:
enter nuber of words n:4
enter 1st word
india
enter integer space word
3 hindu
5 muslim
6 christian
indhimchristian