import java.io.*;

public class DWITE3 {
	public static void main (String [] args) throws IOException {
		BufferedReader inBuff = new BufferedReader(new FileReader("DATA3.txt"));
		PrintWriter outPrint = new PrintWriter(new FileWriter("OUT3.txt"));

		for (int i = 0; i < 5; i++) {
			String input = inBuff.readLine();
			String output;
			output = checkText(input);
			output = checkRel(output);
			outPrint.println(output);
		}
		
		outPrint.close();
	}
	
	public static String checkText (String word) {
		int pos1 = word.indexOf("<a");
		int pos2 = word.indexOf("</a>")+4;
		String result = word.substring(pos1, pos2);
		//System.out.println(result);
		return result;
	}
	
	public static String checkRel (String word) {
		String result = word;
		if (word.indexOf("rel=\"nofollow") == -1) {
			if (word.indexOf("rel=") == -1) {
				int pos1 = word.indexOf(">");
				result = word.substring(0, pos1) + " rel=\"nofollow\"" + word.substring(pos1);
			}
			else if (word.indexOf("rel=") > 0 && ((word.indexOf("rel="))-(word.indexOf("\""))!=0)) { 
				//System.out.println("x");
				int pos1 = word.indexOf("rel=\"")+5;
				int pos2 = word.indexOf("\"", pos1);
				if (pos2-pos1 == 0) {
					result = word.substring(0, pos2) + "nofollow\"" + word.substring(pos2+1);	
				}
				else {
					pos1 = word.indexOf("rel=\"")+6;	
					pos2 = word.indexOf("\"", pos1+1);
					result = word.substring(0, pos2) + " nofollow\"" + word.substring(pos2+1);	
				}
			}	
		}
		System.out.println(result);
		return result;
	}
}
