Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string Smarty(string st)
- {
- string word, lastWord = "";
- int i, nextI;
- i = 0;
- while (i < st.Length)
- {
- nextI = st.IndexOf(' ', i);
- if (nextI < 0)
- nextI = st.Length;
- word = st.Substring(i, nextI - i);
- if (word.Equals(lastWord))
- st = st.Remove(i - 1, nextI - i + 1);
- else
- i = nextI + 1;
- lastWord = word;
- }
- return st;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement