How does your compiler not warn you against using gets()? If you decide to enter something that's longer than twenty characters, it will silently corrupt the stack memory following your variable until it segfaults or reaches the end of your input.

Unless you're dealing with unprintable characters, it seems pointless to have for loops of which their sole function is to print out a string. If you are, why are you declaring three different 4-byte ints for counting? A single short at the beginning would be sufficient for all of the loops, as the first part in a for loop can be used to zero the counter. Otherwise, just use