I remember when I was in first year highschool. My teacher clearly prohibited us swearing, whether in front of her or not. There will be a rotation of who will be listing the names of students in the class swearing. And by homeroom subject time, this will be given to our teacher. What she did was not hit my classmates. She rubbed a teaspoon of salt to the students' tongues. My classmates said it didn't hurt, but what made them stop swearing was the fact that after my teacher did the first student, she will go rubbed salt on another student's tongue without washing her hand. The yucky scene stopped my classmates from swearing, at least during our highschool years.