Medau Therapy Services GmbH | Schloss Hohenfels | 96450 Coburg
Medau Therapy Services GmbH | Schloss Hohenfels | 96450 Coburg
MEDAUtherapie Hygiene neu

MEDAUlogo Praxen für Logopädie

Ihr Partner für die Behandlung von Sprach-, Sprech-, Stimm- und Schluckstörungen an verschiedenen Standorten in Bayern

In den MEDAUlogo Praxen werden Sie von erfahrenen Lehrkräften und Therapeutinnen behandelt, die Expertinnen in ihrem jeweiligen Fachgebiet sind. Hiermit garantieren wir Ihnen eine optimale Behandlung nach aktuellen wissenschaftlichen Leitlinien.

MEDAUlogo ist ein Unternehmenszweig der Medau Therapy Services GmbH.

MEDAUlogo Praxen für Logopädie

Ihr Partner für die Behandlung von Sprach-, Sprech-, Stimm- und Schluckstörungen an verschiedenen Standorten in Bayern

In den MEDAUlogo Praxen werden Sie von erfahrenen Lehrkräften und Therapeutinnen behandelt, die Expertinnen in ihrem jeweiligen Fachgebiet sind. Hiermit garantieren wir Ihnen eine optimale Behandlung nach aktuellen wissenschaftlichen Leitlinien.

MEDAUlogo ist ein Unternehmenszweig der Medau Therapy Services GmbH.

BAMBERG

COBURG

NÜRNBERG

MÜNCHEN

OpenStreetMap

Mit dem Laden der Karte akzeptieren Sie die Datenschutzerklärung von OpenStreetMap Foundation.
Mehr erfahren

Karte laden

PGRpdiBjbGFzcz0ibGVhZmxldC1tYXAgV1BMZWFmbGV0TWFwIiBzdHlsZT0iaGVpZ2h0OjUwMHB4OyB3aWR0aDoxMDAlOyI+PC9kaXY+PHNjcmlwdD4Kd2luZG93LldQTGVhZmxldE1hcFBsdWdpbiA9IHdpbmRvdy5XUExlYWZsZXRNYXBQbHVnaW4gfHwgW107CndpbmRvdy5XUExlYWZsZXRNYXBQbHVnaW4ucHVzaChmdW5jdGlvbiBXUExlYWZsZXRNYXBTaG9ydGNvZGUoKSB7Lyo8c2NyaXB0PiovCnZhciBiYXNlVXJsID0gJ2h0dHBzOi8ve3N9LnRpbGUub3BlbnN0cmVldG1hcC5vcmcve3p9L3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aW9uc1sgb3B0aW9uX25hbWUgXTsKICAgICAgICAgICAgLy8gY29udmVydCAiMSwyIiB0byBbMSwgMl07CiAgICAgICAgICAgIGlmIChvcHRpb24pIHsKICAgICAgICAgICAgICAgIHZhciBhcnIgPSBvcHRpb24uam9pbignJykuc3BsaXQoJywnKTsKICAgICAgICAgICAgICAgIC8vIGFycmF5Lm1hcCBmb3IgaWU8OQogICAgICAgICAgICAgICAgZm9yICh2YXIgaiA9IDAsIGxlbkogPSBhcnIubGVuZ3RoOyBqIDwgbGVuSjsgaisrKSB7CiAgICAgICAgICAgICAgICAgICAgYXJyW2pdID0gTnVtYmVyKGFycltqXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBfb3B0aW9uc1sgb3B0aW9uX25hbWUgXSA9IGFycjsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICAvLyBkZWZhdWx0IHBvcHVwQW5jaG9yCiAgICAgICAgaWYgKCFfb3B0aW9ucy5wb3B1cEFuY2hvcikgewogICAgICAgICAgICAvLyBzZXQgKHJvdWdobHkpIHRvIHNpemUgb2YgaWNvbgogICAgICAgICAgICBfb3B0aW9ucy5wb3B1cEFuY2hvciA9IChmdW5jdGlvbiAoaV9zaXplKSB7CiAgICAgICAgICAgICAgICAvLyBjb3B5IGFycmF5CiAgICAgICAgICAgICAgICBpX3NpemUgPSBpX3NpemUuc2xpY2UoKTsKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLy8gaW52ZXJzZSBjb29yZGluYXRlcwogICAgICAgICAgICAgICAgaV9zaXplWzBdID0gMDsKICAgICAgICAgICAgICAgIGlfc2l6ZVsxXSAqPSAtMTsKICAgICAgICAgICAgICAgIC8vIGJvdHRvbSBwb3NpdGlvbiBvbiBwb3B1cCBpcyA3cHgKICAgICAgICAgICAgICAgIGlfc2l6ZVsxXSAtPSAzOwogICAgICAgICAgICAgICAgcmV0dXJuIGlfc2l6ZTsKICAgICAgICAgICAgfSkoX29wdGlvbnMu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G9yJywgCiAgICAgICAgJ3NoYWRvd1NpemUnLCAKICAgICAgICAnc2hhZG93QW5jaG9yJywKICAgICAgICAncG9wdXBBbmNob3InCiAgICBdOwogICAgdmFyIGRlZmF1bHRfaWNvbiA9IEwuSWNvbi5EZWZhdWx0LnByb3RvdHlwZS5vcHRpb25zOwogICAgaWYgKF9vcHRpb25zLmljb25VcmwpIHsKICAgICAgICAvLyBhcnJheXMgYXJlIHN0cmluZ3MsIHVuZm9ydHVuYXRlbHkuLi4KICAgICAgICBmb3IgKHZhciBpID0gMCwgbGVuID0gaWNvbkFycmF5cy5sZW5ndGg7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgICB2YXIgb3B0aW9uX25hbWUgPSBpY29uQXJyYXlzW2ldOwogICAgICAgICAgICB2YXIgb3B0aW9uID0gX29wdGlvbnNbIG9wdGlvbl9uYW1lIF07CiAgICAgICAgICAgIC8vIGNvbnZlcnQgIjEsMiIgdG8gWzEsIDJdOwogICAgICAgICAgICBpZiAob3B0aW9uKSB7CiAgICAgICAgICAgICAgICB2YXIgYXJyID0gb3B0aW9uLmpvaW4oJycpLnNwbGl0KCcsJyk7CiAgICAgICAgICAgICAgICAvLyBhcnJheS5tYXAgZm9yIGllPDkKICAgICAgICAgICAgICAgIGZvciAodmFyIGogPSAwLCBsZW5KID0gYXJyLmxlbmd0aDsgaiA8IGxlbko7IGorKykgewogICAgICAgICAgICAgICAgICAgIGFycltqXSA9IE51bWJlcihhcnJbal0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgX29wdGlvbnNbIG9wdGlvbl9uYW1lIF0gPSBhcnI7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgLy8gZGVmYXVsdCBwb3B1cEFuY2hvcgogICAgICAgIGlmICghX29wdGlvbnMucG9wdXBBbmNob3IpIHsKICAgICAgICAgICAgLy8gc2V0IChyb3VnaGx5KSB0byBzaXplIG9mIGljb24KICAgICAgICAgICAgX29wdGlvbnMucG9wdXBBbmNob3IgPSAoZnVuY3Rpb24gKGlfc2l6ZSkgewogICAgICAgICAgICAgICAgLy8gY29weSBhcnJheQogICAgICAgICAgICAgICAgaV9zaXplID0gaV9zaXplLnNsaWNlKCk7CiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC8vIGludmVyc2UgY29vcmRpbmF0ZXMKICAgICAgICAgICAgICAgIGlfc2l6ZVswXSA9IDA7CiAgICAgICAgICAgICAgICBpX3NpemVbMV0gKj0gLTE7CiAgICAgICAgICAgICAgICAvLyBib3R0b20gcG9zaXRpb24gb24gcG9wdXAgaXMgN3B4CiAgICAgICAgICAgICAgICBpX3NpemVbMV0gLT0gMzsKICAgICAgICAgICAgICAgIHJldHVybiBpX3NpemU7CiAgICAgICAgICAgIH0pKF9vcHRpb25zLmljb25TaXplIHx8IGRlZmF1bHRfaWNvbi5pY29uU2l6ZSk7CiAgICAgICAgfQogICAgICAgIF9vcHRpb25zLmljb24gPSBuZXcgTC5JY29uKCBfb3B0aW9ucyApOwogICAgfQogICAgcmV0dXJuIF9vcHRpb25zOwp9KSgpOwp2YXIgbWFya2VyID0gTC5tYXJrZXIoCiAgICBbNDguMTI2MzU0MiwxMS41NTE1NzU4XSwgCiAgICBtYXJrZXJfb3B0aW9ucwopOwp2YXIgaXNfaW1hZ2UgPSBtYXAuaXNfaW1hZ2VfbWFwOwppZiAobWFya2VyX29wdGlvbnMuZHJhZ2dhYmxlKSB7CiAgICBtYXJrZXIub24oJ2RyYWdlbmQnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgdmFyIGxhdGxuZyA9IHRoaXMuZ2V0TGF0TG5nKCk7CiAgICAgICAgdmFyIGxhdCA9IGxhdGxuZy5sYXQ7CiAgICAgICAgdmFyIGxuZyA9IGxhdGxuZy5sbmc7CiAgICAgICAgaWYgKGlzX2ltYWdlKSB7CiAgICAgICAgICAgIGNvbnNvbGUubG9nKCdsZWFmbGV0LW1hcmtlciB5PScgKyBsYXQgKyAnIHg9JyArIGxuZyk7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FwIGZvciBpZTw5CiAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gMCwgbGVuSiA9IGFyci5sZW5ndGg7IGogPCBsZW5KOyBqKyspIHsKICAgICAgICAgICAgICAgICAgICBhcnJbal0gPSBOdW1iZXIoYXJyW2pdKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIF9vcHRpb25zWyBvcHRpb25fbmFtZSBdID0gYXJyOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIC8vIGRlZmF1bHQgcG9wdXBBbmNob3IKICAgICAgICBpZiAoIV9vcHRpb25zLnBvcHVwQW5jaG9yKSB7CiAgICAgICAgICAgIC8vIHNldCAocm91Z2hseSkgdG8gc2l6ZSBvZiBpY29uCiAgICAgICAgICAgIF9vcHRpb25zLnBvcHVwQW5jaG9yID0gKGZ1bmN0aW9uIChpX3NpemUpIHsKICAgICAgICAgICAgICAgIC8vIGNvcHkgYXJyYXkKICAgICAgICAgICAgICAgIGlfc2l6ZSA9IGlfc2l6ZS5zbGljZSgpOwogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAvLyBpbnZlcnNlIGNvb3JkaW5hdGVzCiAgICAgICAgICAgICAgICBpX3NpemVbMF0gPSAwOwogICAgICAgICAgICAgICAgaV9zaXplWzFdICo9IC0xOwogICAgICAgICAgICAgICAgLy8gYm90dG9tIHBvc2l0aW9uIG9uIHBvcHVwIGlzIDdweAogICAgICAgICAgICAgICAgaV9zaXplWzFdIC09IDM7CiAgICAgICAgICAgICAgICByZXR1cm4gaV9zaXplOwogICAgICAgICAgICB9KShfb3B0aW9ucy5pY29uU2l6ZSB8fCBkZWZhdWx0X2ljb24uaWNvblNpemUpOwogICAgICAgIH0KICAgICAgICBfb3B0aW9ucy5pY29uID0gbmV3IEwuSWNvbiggX29wdGlvbnMgKTsKICAgIH0KICAgIHJldHVybiBfb3B0aW9uczsKfSkoKTsKdmFyIG1hcmtlciA9IEwubWFya2VyKAogICAgWzQ5LjQ2ODU2L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iAgICBpZiAoX29wdGlvbnMuaWNvblVybCkgewogICAgICAgIC8vIGFycmF5cyBhcmUgc3RyaW5ncywgdW5mb3J0dW5hdGVseS4uLgogICAgICAgIGZvciAodmFyIGkgPSAwLCBsZW4gPSBpY29uQXJyYXlzLmxlbmd0aDsgaSA8IGxlbjsgaSsrKSB7CiAgICAgICAgICAgIHZhciBvcHRpb25fbmFtZSA9IGljb25BcnJheXNbaV07CiAgICAgICAgICAgIHZhciBvcHRpb24gPSBfb3B0aW9uc1sgb3B0aW9uX25hbWUgXTsKICAgICAgICAgICAgLy8gY29udmVydCAiMSwyIiB0byBbMSwgMl07CiAgICAgICAgICAgIGlmIChvcHRpb24pIHsKICAgICAgICAgICAgICAgIHZhciBhcnIgPSBvcHRpb24uam9pbignJykuc3BsaXQoJywnKTsKICAgICAgICAgICAgICAgIC8vIGFycmF5Lm1hcCBmb3IgaWU8OQogICAgICAgICAgICAgICAgZm9yICh2YXIgaiA9IDAsIGxlbkogPSBhcnIubGVuZ3RoOyBqIDwgbGVuSjsgaisrKSB7CiAgICAgICAgICAgICAgICAgICAgYXJyW2pdID0gTnVtYmVyKGFycltqXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBfb3B0aW9uc1sgb3B0aW9uX25hbWUgXSA9IGFycjsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICAvLyBkZWZhdWx0IHBvcHVwQW5jaG9yCiAgICAgICAgaWYgKCFfb3B0aW9ucy5wb3B1cEFuY2hvcikgewogICAgICAgICAgICAvLyBzZXQgKHJvdWdobHkpIHRvIHNpemUgb2YgaWNvbgogICAgICAgICAgICBfb3B0aW9ucy5wb3B1cEFuY2hvciA9IChmdW5jdGlvbiAoaV9zaXplKSB7CiAgICAgICAgICAgICAgICAvLyBjb3B5IGFycmF5CiAgICAgICAgICAgICAgICBpX3NpemUgPSBpX3NpemUuc2xpY2UoKTsKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLy8gaW52ZXJzZSBjb29yZGluYXRlcwogICAgICAgICAgICAgICAgaV9zaXplWzBdID0gMDsKICAgICAgICAgICAgICAgIGlfc2l6ZVsxXSAqPSAtMTsKICAgICAgICAgICAgICAgIC8vIGJvdHRvbSBwb3NpdGlvbiBvbiBwb3B1cCBpcyA3cHgKICAgICAgICAgICAgICAgIGlfc2l6ZVsxXSAtPSAzOwogICAgICAgICAgICAgICAgcmV0dXJuIGlfc2l6ZTsKICAgICAgICAgICAgfSkoX29wdGlvbnMuaWNvblNpemUgfHwgZGVmYXVsdF9pY29uLmljb25TaXplKTsKICAgICAgICB9CiAgICAgICAgX29wdGlvbnMuaWNvbiA9IG5ldyBMLkljb24oIF9vcHRpb25zICk7CiAgICB9CiAgICByZXR1cm4gX29wdGlvbnM7Cn0pKCk7CnZhciBtYXJrZXIgPSBMLm1hcmtlcigKICAgIFs0OS44OTA4MDExLDEwLjg5MzIwNDRdLCAKICAgIG1hcmtlcl9vcHRpb25zCik7CnZhciBpc19pbWFnZSA9IG1hcC5pc19pbWFnZV9tYXA7CmlmIChtYXJrZXJfb3B0aW9ucy5kcmFnZ2FibGUpIHsKICAgIG1hcmtlci5vbignZHJhZ2VuZCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICB2YXIgbGF0bG5nID0gdGhpcy5nZXRMYXRMbmcoKTsKICAgICAgICB2YXIgbGF0ID0gbGF0bG5nLmxhdDsKICAgICAgICB2YXIgbG5nID0gbGF0bG5nLmxuZzsKICAgICAgICBpZiAoaXNfaW1hZ2UpIHsKICAgICAgICAgICAgY29uc29sZS5sb2coJ2xlYWZsZXQtbWFya2VyIHk9JyArIGxhdCArICcgeD0nICsgbG5nKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjb25zb2xlLmxvZygnbGVhZmxldC1tYXJrZXIgbGF0PScgKyBsYXQgKyAnIGxuZz0nICsgbG5nKTsKICAgICAgICB9CiAgICB9KTsKfQptYXJrZXIuYWRkVG8oIGdyb3VwICk7Cm1hcmtlci5iaW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nVuY3Rpb24gKCkgewogICAgdmFyIF9vcHRpb25zID0geyJpY29uVXJsIjoiXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDE3XC8wOFwvbWFya2VyLnBuZyIsImljb25TaXplIjpbIjUxLDU4Il0sImljb25BbmNob3IiOlsiMjUuNSw1OCJdfTsKICAgIHZhciBpY29uQXJyYXlzID0gWwogICAgICAgICdpY29uU2l6ZScsIAogICAgICAgICdpY29uQW5jaG9yJywgCiAgICAgICAgJ3NoYWRvd1NpemUnLCAKICAgICAgICAnc2hhZG93QW5jaG9yJywKICAgICAgICAncG9wdXBBbmNob3InCiAgICBdOwogICAgdmFyIGRlZmF1bHRfaWNvbiA9IEwuSWNvbi5EZWZhdWx0LnByb3RvdHlwZS5vcHRpb25zOwogICAgaWYgKF9vcHRpb25zLmljb25VcmwpIHsKICAgICAgICAvLyBhcnJheXMgYXJlIHN0cmluZ3MsIHVuZm9ydHVuYXRlbHkuLi4KICAgICAgICBmb3IgKHZhciBpID0gMCwgbGVuID0gaWNvbkFycmF5cy5sZW5ndGg7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgICB2YXIgb3B0aW9uX25hbWUgPSBpY29uQXJyYXlzW2ldOwogICAgICAgICAgICB2YXIgb3B0aW9uID0gX29wdGlvbnNbIG9wdGlvbl9uYW1lIF07CiAgICAgICAgICAgIC8vIGNvbnZlcnQgIjEsMiIgdG8gWzEsIDJdOwogICAgICAgICAgICBpZiAob3B0aW9uKSB7CiAgICAgICAgICAgICAgICB2YXIgYXJyID0gb3B0aW9uLmpvaW4oJycpLnNwbGl0KCcsJyk7CiAgICAgICAgICAgICAgICAvLyBhcnJheS5tYXAgZm9yIGllPDkKICAgICAgICAgICAgICAgIGZvciAodmFyIGogPSAwLCBsZW5KID0gYXJyLmxlbmd0aDsgaiA8IGxlbko7IGorKykgewogICAgICAgICAgICAgICAgICAgIGFycltqXSA9IE51bWJlcihhcnJbal0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgX29wdGlvbnNbIG9wdGlvbl9uYW1lIF0gPSBhcnI7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgLy8gZGVmYXVsdCBwb3B1cEFuY2hvcgogICAgICAgIGlmICghX29wdGlvbnMucG9wdXBBbmNob3IpIHsKICAgICAgICAgICAgLy8gc2V0IChyb3VnaGx5KSB0byBzaXplIG9mIGljb24KICAgICAgICAgICAgX29wdGlvbnMucG9wdXBBbmNob3IgPSAoZnVuY3Rpb24gKGlfc2l6ZSkgewogICAgICAgICAgICAgICAgLy8gY29weSBhcnJheQogICAgICAgICAgICAgICAgaV9zaXplID0gaV9zaXplLnNsaWNlKCk7CiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC8vIGludmVyc2UgY29vcmRpbmF0ZXMKICAgICAgICAgICAgICAgIGlfc2l6ZVswXSA9IDA7CiAgICAgICAgICAgICAgICBpX3NpemVbMV0gKj0gLTE7CiAgICAgICAgICAgICAgICAvLyBib3R0b20gcG9zaXRpb24gb24gcG9wdXAgaXMgN3B4CiAgICAgICAgICAgICAgICBpX3NpemVbMV0gLT0gMzsKICAgICAgICAgICAgICAgIHJldHVybiBpX3NpemU7CiAgICAgICAgICAgIH0pKF9vcHRpb25zLmljb25TaXplIHx8IGRlZmF1bHRfaWNvbi5pY29uU2l6ZSk7CiAgICAgICAgfQogICAgICAgIF9vcHRpb25zLmljb24gPSBuZXcgTC5JY29uKCBfb3B0aW9ucyApOwogICAgfQogICAgcmV0dXJuIF9vcHRpb25zOwp9KSgpOwp2YXIgbWFya2VyID0gTC5tYXJrZXIoCiAgICBbNTAuMjE3NzQ4MSwxMS4xNDE1OTU4XSwgCiAgICBtYXJrZXJfb3B0aW9ucwopOwp2YXIgaXNfaW1hZ2UgPSBtYXAuaXNfaW1hZ2VfbWFwOwppZiAobWFya2VyX29wdGlvbnMuZHJhZ2dhYmxlKSB7CiAgICBtYXJrZXIub24oJ2RyYWdlbmQnLCBmdW5jdGlvbiAoKSB7CiAgICA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