Shifty Eyes Shifting I's Shifty-eyes ASCII guys like to shift ASCII Ii's:
&gt;_&gt; &lt;_&lt; &gt;_&lt; &lt;_&gt;

Given a string of shifty-guys, spaced apart or separate lines, shift the Ii's side to side, left the wall and right the skies:
Ii

The shortest shifter wins the prize.
Say What?
Write a program or function that takes in a string of an arbitrary list of these four ASCII emoticons, either space or newline separated (with an optional trailing newline):
&gt;_&gt;
&lt;_&lt;
&gt;_&lt;
&lt;_&gt;


For example, the input might be
&gt;_&gt; &gt;_&gt; &lt;_&gt;

or
&gt;_&gt;
&gt;_&gt;
&lt;_&gt;

(The method you support is up to you.)

Each emoticon performs a different action on the I and i characters, which always start like this:
Ii


&gt;_&gt; shifts I to the right by one, if possible, and then shifts i to the right by one.
&lt;_&lt; shifts I to the left by one, if possible, and then shifts i to the left by one, if possible.
&gt;_&lt; shifts I to the right by one, if possible, and then shifts i to the left by one, if possible.
&lt;_&gt; shifts I to the left by one, if possible, and then shifts i to the right by one.

I cannot be shifted left if it is at the left edge of the line (as it is initially), and cannot be shifted right if i is directly to its right (as it is initially).
i cannot be shifted left if I is directly to its left (as it is initially), but can always be shifted right.
Note that with these rules, I will always remain to the left of i, and I is attempted to be shifted before i for all emoticons.
Your program or function needs to print or return a string of the final Ii line after applying all the shifts in the order given, using spaces ( ) or periods (.) for empty space. Trailing spaces or periods and a single trailing newline are optionally allowed in the output. Don't mix spaces and periods.

For example, the input
&gt;_&gt;
&gt;_&gt;
&lt;_&gt;

has output
I...i

because the shifts apply like
start  |Ii
&gt;_&gt;    |I.i 
&gt;_&gt;    |.I.i
&lt;_&gt;    |I...i


The shortest code in bytes wins. Tiebreaker is higher voted answer.
Test Cases
#[id number]
[space separated input]
[output]

Using . for clarity.
#0
[empty string]
Ii

#1
&gt;_&gt;
I.i

#2
&lt;_&lt;
Ii

#3
&gt;_&lt;
Ii

#4
&lt;_&gt;
I.i

#5
&gt;_&gt; &gt;_&gt;
.I.i

#6
&gt;_&gt; &lt;_&lt;
Ii

#7
&gt;_&gt; &gt;_&lt;
.Ii

#8
&gt;_&gt; &lt;_&gt;
I..i

#9
&lt;_&lt; &gt;_&gt;
I.i

#10
&lt;_&lt; &lt;_&lt;
Ii

#11
&lt;_&lt; &gt;_&lt;
Ii

#12
&lt;_&lt; &lt;_&gt;
I.i

#13
&gt;_&lt; &gt;_&gt;
I.i

#14
&gt;_&lt; &lt;_&lt;
Ii

#15
&gt;_&lt; &gt;_&lt;
Ii

#16
&gt;_&lt; &lt;_&gt;
I.i

#17
&lt;_&gt; &gt;_&gt;
.I.i

#18
&lt;_&gt; &lt;_&lt;
Ii

#19
&lt;_&gt; &gt;_&lt;
.Ii

#20
&lt;_&gt; &lt;_&gt;
I..i

#21
&gt;_&gt; &gt;_&gt; &lt;_&gt;
I...i

#22
&lt;_&gt; &gt;_&gt; &gt;_&gt; &gt;_&gt; &lt;_&gt; &lt;_&lt;
.I...i

#23
&lt;_&gt; &gt;_&gt; &gt;_&gt; &gt;_&gt; &lt;_&gt; &lt;_&lt; &gt;_&lt; &lt;_&lt; &gt;_&lt;
..Ii

#24
&gt;_&gt; &gt;_&lt; &gt;_&gt; &gt;_&gt; &gt;_&gt; &gt;_&gt; &gt;_&gt; &gt;_&gt; &lt;_&gt; &lt;_&gt; &lt;_&lt;
...I.....i
Perl, 59 56 54 bytes

Includes +1 for -p

Run with the input on STDIN, e.g. perl -p shifty.pl &lt;&lt;&lt; "&gt;_&gt; &lt;_&lt; &gt;_&lt; &lt;_&gt;"

shifty.pl:

s%^|&lt;|(&gt;)%y/iI/Ii/or$_=Ii;$1?s/i |i$/ i/:s/ i/i /%reg


Explanation

The control string alternates instructions for i and I and the rule is the same for both of them if you formulate them as:


&lt; Move left if there is a space to the left
&gt; Move right if there is a space or end of string to the right


So I'm going to swap i and I in the target string at each step so I only need to apply the rule to one letter ever. This is the y/iI/Ii/

I will walk the control string looking for &lt; and &gt; using a substitution which is usually the shortest way in perl to process something character by character. To avoid having to write $var =~ I want the control string in the perl default variable $_. And I also want an easy way to distinguish &lt; from &gt;. All this can be accomplished using

s%&lt;|(&gt;)%  code using $1 to distinguish &lt; from &gt; %eg


The target string I also want to manipulate using substitutions and for the same reason I want that in $_ too. $_ being two things at once seems impossible.

However I can have my cake and eat it too because the $_ inside the body of a substitution does not have to remain the same as the $_ being substituded. Once perl started substituting a string this string will not change even if you change the variable the string originally came from. So you can do something like:

s%&lt;|(&gt;)% change $_ here without disturbing the running substitution %eg


I want to replace the original $_ by the initial "Ii" only the very first time the substitution body gets executed (otherwise I keep resetting the target string). This replacement however also has to happen for an empty control string, so even for the empty control string the body needs to be executed at least once. To make sure the substition runs an extra time at the start of the control string (even for empty control strings) I change the substitution to:

s%^|&lt;|(&gt;)% change $_ here without disturbing the running substitution %eg


I will run the y/iI/Ii/ as the first thing inside the substitution code. While $_ is still the control string this won't yet contain any Ii, so if the transliteration indicates nothing was changed that is my trigger initialize $_:

y/iI/Ii/or$_=Ii


Now I can implement the actual moving of the letters. Since I start with a swap all moves should be done on i, not I. If $1 is set move i to the right:

s/i |i$/ i/


If $1 is not set move i to the left

s/ i/i /


Notice that at the start of the control string when I match ^ $1 will not be set, so it tries to move i to the left on the initial string Ii. This won't work because there is no space there, so the intial string remains undisturbed (this is why I put the () around &gt; instead of &lt;)

Only one problem remains: at the end of the outer substitution $_ is set to result of the outer substitution regardless of what you did to $_ inside the substitution body. So the target string with the proper placement of i and I gets lost. In older perls this would be a fatal flaw. More recent perls however have the r modifier which means "make a copy of the original string, do your substitution on that and return the resulting string (instead of number of matches)". When I use that here the result is that the modified command string gets discarded while the original $_ is not disturbed by perl and left after the substitution. However the disturbing I do on $_ is still done after perl left $_ alone. So at the end $_ will be the proper target string.

The -p option makes sure the original string is in $_ and also prints the final $_.