# Texting Around

Two problems.

1. Diagonal Text (diagtext.py, diagtext-tests.txt): Input a string s with a length l. Input an integer n between 1 and l. If the input n is not in range, exit with the message "number should be between 1 and the length of the string". It is OK for the program to crash if the string given as n is not actually convertible into an integer.

Print s with all but every n-th character replaced by '.', starting with the first. Then print s again with all but every n-th character replaced by '.', starting with the second. Keep doing this until you have printed the substituted string n times. For example:

    string? hello world
count? 3
h..l..w..l.
.e..o..o..d
..l.. ..r..


Some hints:

• You can make the program stop at any time by calling the exit() function.
• You can print a character or string s without starting a new line with print(s, end='').
• You can just start a new line without printing anything with print().
2. X Strings (xstrings.py, xstrings-tests.txt): Input a string. Output the starting position and length of the first occurrence of the longest substring of capital Xs in that string. The first letter is in position 1. For example:

    ? XabXXXXXxxxXXXXXyyXX
position=4 length=5


If there are no Xs in the input string, print "no Xs".

I don't care what algorithm you use. If you are bored, try to find a fast algorithm for this.

Your assignment is to write and test a program that meets each specification. Submit each program as a text file with the name given in the problem. Submit test runs of each problem as a text file with the name given in the problem. Also include a text file called "writeup.txt" containing a writeup that contains a brief note about what you did, what problems you had, and what you learned.