# -*- coding: utf-8 -*-
def toIF(kana):
   #step 1: basic processing
   t = []
   for x in kana:
      t.append(__getRomaji(x))
   
   t2 = []
   #step 2: process special characters
   t2pos = 0
   for i in range(len(t)):
      if i > 0 and t[i-1][0] == ">": continue
      if t[i][0] == "<":
         if i > 0:
            t2.append(__getSpecial((t[i-1], t[i])))
            t2.pop(t2pos-1)
      elif t[i][0] == ">":
         if i < len(t)-1:
            t2.append(t[i+1][0] + t[i+1])
            t2.append(__getSpecial((t[i], t[i+1])))
      else:
         t2.append(t[i])
         t2pos += 1
      
   return t2
   
def __getRomaji(kana):
  try:
      ret = ktor[kana]
  except KeyError:
      ret = ""
  return ret

def __getSpecial(rom):
  try:
      ret = special[rom]
  except KeyError:
      ret = ""
  return ret

ktor = {}
ktor["あ"] = "a"
ktor["ア"] = "A"
ktor["い"] = "i"
ktor["イ"] = "I"
ktor["う"] = "u"
ktor["ウ"] = "U"
ktor["え"] = "e"
ktor["エ"] = "E"
ktor["お"] = "o"
ktor["オ"] = "O"
ktor["か"] = "ka"
ktor["カ"] = "KA"
ktor["き"] = "ki"
ktor["キ"] = "KI"
ktor["く"] = "ku"
ktor["ク"] = "KU"
ktor["け"] = "ke"
ktor["ケ"] = "KE"
ktor["こ"] = "ko"
ktor["コ"] = "KO"
ktor["さ"] = "sa"
ktor["サ"] = "SA"
ktor["し"] = "shi"
ktor["シ"] = "SHI"
ktor["す"] = "su"
ktor["ス"] = "SU"
ktor["せ"] = "se"
ktor["セ"] = "SE"
ktor["そ"] = "so"
ktor["ソ"] = "SO"
ktor["た"] = "ta"
ktor["タ"] = "TA"
ktor["ち"] = "chi"
ktor["チ"] = "CHI"
ktor["つ"] = "tsu"
ktor["ツ"] = "TSU"
ktor["て"] = "te"
ktor["テ"] = "TE"
ktor["と"] = "to"
ktor["ト"] = "TO"
ktor["な"] = "na"
ktor["ナ"] = "NA"
ktor["に"] = "ni"
ktor["ニ"] = "NI"
ktor["ぬ"] = "nu"
ktor["ヌ"] = "NU"
ktor["ね"] = "ne"
ktor["ネ"] = "NE"
ktor["の"] = "no"
ktor["ノ"] = "NO"
ktor["は"] = "ha"
ktor["ハ"] = "HA"
ktor["ひ"] = "hi"
ktor["ヒ"] = "HI"
ktor["ふ"] = "fu"
ktor["フ"] = "FU"
ktor["へ"] = "he"
ktor["ヘ"] = "HE"
ktor["ほ"] = "ho"
ktor["ホ"] = "HO"
ktor["ま"] = "ma"
ktor["マ"] = "MA"
ktor["み"] = "mi"
ktor["ミ"] = "MI"
ktor["む"] = "mu"
ktor["ム"] = "MU"
ktor["め"] = "me"
ktor["メ"] = "ME"
ktor["も"] = "mo"
ktor["モ"] = "MO"
ktor["や"] = "ya"
ktor["ヤ"] = "YA"
ktor["ゆ"] = "yu"
ktor["ユ"] = "YU"
ktor["よ"] = "yo"
ktor["ヨ"] = "YO"
ktor["ら"] = "ra"
ktor["ラ"] = "RA"
ktor["り"] = "ri"
ktor["リ"] = "RI"
ktor["る"] = "ru"
ktor["ル"] = "RU"
ktor["れ"] = "re"
ktor["レ"] = "RE"
ktor["ろ"] = "ro"
ktor["ロ"] = "RO"
ktor["わ"] = "wa"
ktor["ワ"] = "WA"
ktor["を"] = "wo"
ktor["ヲ"] = "WO"
ktor["が"] = "ga"
ktor["ガ"] = "GA"
ktor["ぎ"] = "gi"
ktor["ギ"] = "GI"
ktor["ぐ"] = "gu"
ktor["グ"] = "GU"
ktor["げ"] = "ge"
ktor["ゲ"] = "GE"
ktor["ご"] = "go"
ktor["ゴ"] = "GO"
ktor["ざ"] = "za"
ktor["ザ"] = "ZA"
ktor["じ"] = "ji"
ktor["ジ"] = "JI"
ktor["ず"] = "zu"
ktor["ズ"] = "ZU"
ktor["ぜ"] = "ze"
ktor["ゼ"] = "ZE"
ktor["ぞ"] = "zo"
ktor["ゾ"] = "ZO"
ktor["だ"] = "da"
ktor["ダ"] = "DA"
ktor["ぢ"] = "di"
ktor["ヂ"] = "DI"
ktor["づ"] = "du"
ktor["ヅ"] = "DU"
ktor["で"] = "de"
ktor["デ"] = "DE"
ktor["ど"] = "do"
ktor["ド"] = "DO"
ktor["ば"] = "ba"
ktor["バ"] = "BA"
ktor["び"] = "bi"
ktor["ビ"] = "BI"
ktor["ぶ"] = "bu"
ktor["ブ"] = "BU"
ktor["べ"] = "be"
ktor["ベ"] = "BE"
ktor["ぼ"] = "bo"
ktor["ボ"] = "BO"
ktor["ぱ"] = "pa"
ktor["パ"] = "PA"
ktor["ぴ"] = "pi"
ktor["ピ"] = "PI"
ktor["ぷ"] = "pu"
ktor["プ"] = "PU"
ktor["ぺ"] = "pe"
ktor["ペ"] = "PE"
ktor["ぽ"] = "po"
ktor["ポ"] = "PO"
ktor["ー"] = "-"
ktor["。"] = "."
ktor["？"] = "?"
ktor["！"] = "!"
ktor["、"] = ","
ktor["　"] = "_"
ktor["（"] = "["
ktor["）"] = "]"
ktor["〜"] = "~"
ktor["ゃ"] = "<ya"
ktor["ャ"] = "<YA"
ktor["ゅ"] = "<yu"
ktor["ュ"] = "<YU"
ktor["ょ"] = "<yo"
ktor["ョ"] = "<YO"
ktor["ん"] = "n"
ktor["ン"] = "N"
ktor["っ"] = ">tsu"
ktor["ッ"] = ">TSU"
ktor["「"] = "'"
ktor["」"] = "'"
ktor["ゐ"] = "wi"
ktor["ヰ"] = "WI"

special = {}
special[("ni","<ya")] = "nya"
special[("NI","<YA")] = "NYA"
special[("ni","<yu")] = "nyu"
special[("NI","<YU")] = "NYU"
special[("ni","<yo")] = "nyo"
special[("NI","<YO")] = "NYO"
special[("ki","<ya")] = "kya"
special[("KI","<YA")] = "KYA"
special[("ki","<yu")] = "kyu"
special[("KI","<YU")] = "KYU"
special[("ki","<yo")] = "kyo"
special[("KI","<YO")] = "KYO"
special[("shi","<ya")] = "sha"
special[("SHI","<YA")] = "SHA"
special[("shi","<yu")] = "shu"
special[("SHI","<YU")] = "SHU"
special[("shi","<yo")] = "sho"
special[("SHI","<YO")] = "SHO"
special[("chi","<ya")] = "cha"
special[("CHI","<YA")] = "CHA"
special[("chi","<yu")] = "chu"
special[("CHI","<YU")] = "CHU"
special[("chi","<yo")] = "cho"
special[("CHI","<YO")] = "CHO"
special[("hi","<ya")] = "hya"
special[("HI","<YA")] = "HYA"
special[("hi","<yu")] = "hyu"
special[("HI","<YU")] = "HYU"
special[("hi","<yo")] = "hyo"
special[("HI","<YO")] = "HYO"
special[("mi","<ya")] = "mya"
special[("MI","<YA")] = "MYA"
special[("mi","<yu")] = "myu"
special[("MI","<YU")] = "MYU"
special[("mi","<yo")] = "myo"
special[("MI","<YO")] = "MYO"
special[("ri","<ya")] = "rya"
special[("RI","<YA")] = "RYA"
special[("ri","<yu")] = "ryu"
special[("RI","<YU")] = "RYU"
special[("ri","<yo")] = "ryo"
special[("RI","<YO")] = "RYO"
special[("gi","<ya")] = "gya"
special[("GI","<YA")] = "GYA"
special[("gi","<yu")] = "gyu"
special[("GI","<YU")] = "GYU"
special[("gi","<yo")] = "gyo"
special[("GI","<YO")] = "GYO"
special[("ji","<ya")] = "ja"
special[("JI","<YA")] = "JA"
special[("ji","<yu")] = "ju"
special[("JI","<YU")] = "JU"
special[("ji","<yo")] = "jo"
special[("JI","<YO")] = "JO"
special[("bi","<ya")] = "bya"
special[("BI","<YA")] = "BYA"
special[("bi","<yu")] = "byu"
special[("BI","<YU")] = "BYU"
special[("bi","<yo")] = "byo"
special[("BI","<YO")] = "BYO"
special[("pi","<ya")] = "pya"
special[("PI","<YA")] = "PYA"
special[("pi","<yu")] = "pyu"
special[("PI","<YU")] = "PYU"
special[("pi","<yo")] = "pyo"
special[("PI","<YO")] = "PYO"
special[("di","<ya")] = "dya"
special[("DI","<YA")] = "DYA"
special[("di","<yu")] = "dyu"
special[("DI","<YU")] = "DYU"
special[("di","<yo")] = "dyo"
special[("DI","<YO")] = "DYO"
