# -*- coding: utf-8 -*-
"""
Skripto gabaliukai skirti greitai is BiBTeX gauti vienodo formato autoriu sarasa: N. Surname, N. Surname, ...



"""

#%%

Auth = r'Couairon, A. and Jukna, V. and Darginavi{\v{c}}ius, J. and Majus, D. and Garejev, N. and Gra{\v{z}}ulevi{\v{c}}i{\={u}}t{\.{e}}, I. and Valiulis, G. and Tamo{\v{s}}auskas, G. and Dubietis, A. and Silva, F. and Austin, D. R. and Hemmer, M. and Baudisch, M. and Thai, A. and Biegert, J. and Faccio, D. and Jarnac, A. and Houard, A. and Liu, Y. and Mysyrowicz, A. and Grabielle, S. and Forget, N. and Dur{\'e}cu, A. and Durand, M. and Lim, K. and McKee, E. and Baudelet, M. and Richardson, M.'
Auth = r'Garejev, N. and Gra\ifmmode \check{z}\else \v{z}\fi{}ulevi\ifmmode \check{c}\else \v{c}\fi{}i\ifmmode \bar{u}\else \={u}\fi{}t\ifmmode \dot{e}\else \.{e}\fi{}, I. and Majus, D. and Tamo\ifmmode \check{s}\else \v{s}\fi{}auskas, G. and Jukna, V. and Couairon, A. and Dubietis, A.'
Auth = r'Majus, D. and Tamo\ifmmode \check{s}\else \v{s}\fi{}auskas, G. and Gra\ifmmode \check{z}\else \v{z}\fi{}ulevi\ifmmode \check{c}\else \v{c}\fi{}i\ifmmode \bar{u}\else \={u}\fi{}t\ifmmode \dot{e}\else \.{e}\fi{}, I. and Garejev, N. and Lotti, A. and Couairon, A. and Faccio, D. and Dubietis, A.'

auth_new = []

for a in Auth.split(' and '):
    ast = a.strip()
    aels = ast.split(', ')
    auth_new.append(aels[1].replace(' ','~') + '~' + aels[0])
    
    
print(', '.join(auth_new))



#%%


Auth = r'Vytautas Jukna and Nail Garejev and Gintaras Tamo\v{s}auskas and Audrius Dubietis'
Auth = r'Julius Darginavi\v{c}ius and Nail Garejev and Audrius Dubietis'
Auth = r'Nail Garejev and Gintaras Tamo\v{s}auskas and Audrius Dubietis'
Auth = r'Julius Darginavi\v{c}ius and Donatas Majus and Vytautas Jukna and Nail Garejev and Gintaras Valiulis and Arnaud Couairon and Audrius Dubietis'
Auth = r'Agn{\.{e}} Marcinkevi{\v{c}}i{\={u}}t{\.{e}} and Nail Garejev and Rosvaldas {\v{S}}uminas and Gintaras Tamo{\v{s}}auskas and Audrius Dubietis'



auth_new = []

for a in Auth.split(' and '):
    ast = a.strip()
    aels = ast.split(' ')
    aels_new = []
    for ael in aels[:-1]:
        aels_new.append(ael[0].upper() + '.')
    aels_new.append(aels[-1])
    auth_new.append('~'.join(aels_new))
    
    
print(', '.join(auth_new))



#%%



Auth = r'N. Garejev and V. Jukna and G. Tamo\v{s}auskas and M. Veli\v{c}k\.{e} and R. \v{S}uminas and A. Couairon and A. Dubietis'
Auth = r'A. Marcinkevi\v{c}i\={u}t\.{e} and V. Jukna and R. \v{S}uminas and N. Garejev and G. Tamo\v{s}auskas and A. Dubietis'

auth_new = []

for a in Auth.split(' and '):
    ast = a.strip()
    aels = ast.split(' ')
    auth_new.append(aels[0].replace(' ','~') + '~' + aels[1])
    
    
print(', '.join(auth_new))